mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-10-03 22:31:49 +00:00
Merging fpga with next
This commit is contained in:
+457
-382
File diff suppressed because it is too large
Load Diff
@@ -34,9 +34,9 @@
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
#if defined GNUPLOT_EXECUTABLE
|
||||
DEFINE_string(gnuplot_executable, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path");
|
||||
DEFINE_string(gnuplot_executable, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path");
|
||||
#elif !defined GNUPLOT_EXECUTABLE
|
||||
DEFINE_string(gnuplot_executable, "", "Gnuplot binary path");
|
||||
DEFINE_string(gnuplot_executable, "", "Gnuplot binary path");
|
||||
#endif
|
||||
|
||||
DEFINE_bool(plot_acq_grid, false, "Plots acquisition grid with gnuplot");
|
||||
|
||||
@@ -50,8 +50,6 @@
|
||||
#include <queue>
|
||||
|
||||
|
||||
|
||||
|
||||
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
||||
|
||||
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||
@@ -64,20 +62,22 @@ int main(int argc, char **argv)
|
||||
{
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
try
|
||||
{
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
}
|
||||
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
int res = 0;
|
||||
try
|
||||
{
|
||||
{
|
||||
res = RUN_ALL_TESTS();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG(WARNING) << "Unexpected catch";
|
||||
}
|
||||
}
|
||||
google::ShutDownCommandLineFlags();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
||||
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||
|
||||
|
||||
class ObsGpsL1SystemTest: public ::testing::Test
|
||||
class ObsGpsL1SystemTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
std::string generator_binary;
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
void check_results();
|
||||
bool check_valid_rinex_nav(std::string filename); // return true if the file is a valid Rinex navigation file.
|
||||
bool check_valid_rinex_obs(std::string filename); // return true if the file is a valid Rinex observation file.
|
||||
double compute_stdev(const std::vector<double> & vec);
|
||||
double compute_stdev(const std::vector<double>& vec);
|
||||
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
};
|
||||
@@ -94,12 +94,12 @@ bool ObsGpsL1SystemTest::check_valid_rinex_nav(std::string filename)
|
||||
}
|
||||
|
||||
|
||||
double ObsGpsL1SystemTest::compute_stdev(const std::vector<double> & vec)
|
||||
double ObsGpsL1SystemTest::compute_stdev(const std::vector<double>& vec)
|
||||
{
|
||||
double sum__ = std::accumulate(vec.begin(), vec.end(), 0.0);
|
||||
double mean__ = sum__ / vec.size();
|
||||
double accum__ = 0.0;
|
||||
std::for_each (std::begin(vec), std::end(vec), [&](const double d) {
|
||||
std::for_each(std::begin(vec), std::end(vec), [&](const double d) {
|
||||
accum__ += (d - mean__) * (d - mean__);
|
||||
});
|
||||
double stdev__ = std::sqrt(accum__ / (vec.size() - 1));
|
||||
@@ -121,18 +121,18 @@ int ObsGpsL1SystemTest::configure_generator()
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if(FLAGS_dynamic_position.empty())
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(std::min(FLAGS_duration * 10, 3000));
|
||||
if(FLAGS_duration > 300) std::cout << "WARNING: Duration has been set to its maximum value of 300 s" << std::endl;
|
||||
if (FLAGS_duration > 300) std::cout << "WARNING: Duration has been set to its maximum value of 300 s" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ int ObsGpsL1SystemTest::generate_signal()
|
||||
pid_t wait_result;
|
||||
int child_status;
|
||||
|
||||
char *const parmList[] = { &generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL };
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
@@ -157,7 +157,7 @@ int ObsGpsL1SystemTest::generate_signal()
|
||||
wait_result = waitpid(pid, &child_status, 0);
|
||||
if (wait_result == -1) perror("waitpid error");
|
||||
EXPECT_EQ(true, check_valid_rinex_obs(filename_rinex_obs));
|
||||
std::cout << "Signal and Observables RINEX files created." << std::endl;
|
||||
std::cout << "Signal and Observables RINEX files created." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ int ObsGpsL1SystemTest::configure_receiver()
|
||||
const int extend_correlation_ms = 1;
|
||||
|
||||
const int display_rate_ms = 500;
|
||||
const int output_rate_ms = 100;
|
||||
const int output_rate_ms = 100;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal));
|
||||
|
||||
@@ -326,20 +326,20 @@ int ObsGpsL1SystemTest::run_receiver()
|
||||
control_thread = std::make_shared<ControlThread>(config);
|
||||
// start receiver
|
||||
try
|
||||
{
|
||||
{
|
||||
control_thread->run();
|
||||
}
|
||||
catch(const boost::exception & e)
|
||||
{
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
// Get the name of the RINEX obs file generated by the receiver
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
FILE *fp;
|
||||
FILE* fp;
|
||||
std::string argum2 = std::string("/bin/ls *O | grep GSDR | tail -1");
|
||||
char buffer[1035];
|
||||
fp = popen(&argum2[0], "r");
|
||||
@@ -360,17 +360,17 @@ int ObsGpsL1SystemTest::run_receiver()
|
||||
|
||||
void ObsGpsL1SystemTest::check_results()
|
||||
{
|
||||
std::vector<std::vector<std::pair<double, double>> > pseudorange_ref(33);
|
||||
std::vector<std::vector<std::pair<double, double>> > carrierphase_ref(33);
|
||||
std::vector<std::vector<std::pair<double, double>> > doppler_ref(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> pseudorange_ref(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> carrierphase_ref(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> doppler_ref(33);
|
||||
|
||||
std::vector<std::vector<std::pair<double, double>> > pseudorange_meas(33);
|
||||
std::vector<std::vector<std::pair<double, double>> > carrierphase_meas(33);
|
||||
std::vector<std::vector<std::pair<double, double>> > doppler_meas(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> pseudorange_meas(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> carrierphase_meas(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> doppler_meas(33);
|
||||
|
||||
// Open and read reference RINEX observables file
|
||||
try
|
||||
{
|
||||
{
|
||||
gpstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs);
|
||||
r_ref.exceptions(std::ios::failbit);
|
||||
gpstk::Rinex3ObsData r_ref_data;
|
||||
@@ -384,53 +384,53 @@ void ObsGpsL1SystemTest::check_results()
|
||||
{
|
||||
for (int myprn = 1; myprn < 33; myprn++)
|
||||
{
|
||||
gpstk::SatID prn( myprn, gpstk::SatID::systemGPS );
|
||||
gpstk::SatID prn(myprn, gpstk::SatID::systemGPS);
|
||||
gpstk::CommonTime time = r_ref_data.time;
|
||||
double sow(static_cast<gpstk::GPSWeekSecond>(time).sow);
|
||||
|
||||
gpstk::Rinex3ObsData::DataMap::iterator pointer = r_ref_data.obs.find(prn);
|
||||
if( pointer == r_ref_data.obs.end() )
|
||||
if (pointer == r_ref_data.obs.end())
|
||||
{
|
||||
// PRN not present; do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
dataobj = r_ref_data.getObs(prn, "C1C", r_ref_header);
|
||||
dataobj = r_ref_data.getObs(prn, "C1C", r_ref_header);
|
||||
double P1 = dataobj.data;
|
||||
std::pair<double, double> pseudo(sow,P1);
|
||||
std::pair<double, double> pseudo(sow, P1);
|
||||
pseudorange_ref.at(myprn).push_back(pseudo);
|
||||
|
||||
dataobj = r_ref_data.getObs(prn, "L1C", r_ref_header);
|
||||
dataobj = r_ref_data.getObs(prn, "L1C", r_ref_header);
|
||||
double L1 = dataobj.data;
|
||||
std::pair<double, double> carrier(sow, L1);
|
||||
carrierphase_ref.at(myprn).push_back(carrier);
|
||||
|
||||
dataobj = r_ref_data.getObs(prn, "D1C", r_ref_header);
|
||||
dataobj = r_ref_data.getObs(prn, "D1C", r_ref_header);
|
||||
double D1 = dataobj.data;
|
||||
std::pair<double, double> doppler(sow, D1);
|
||||
doppler_ref.at(myprn).push_back(doppler);
|
||||
} // End of 'if( pointer == roe.obs.end() )'
|
||||
} // end for
|
||||
} // end while
|
||||
} // End of 'try' block
|
||||
catch(const gpstk::FFStreamError& e)
|
||||
{
|
||||
} // end for
|
||||
} // end while
|
||||
} // End of 'try' block
|
||||
catch (const gpstk::FFStreamError& e)
|
||||
{
|
||||
std::cout << e;
|
||||
exit(1);
|
||||
}
|
||||
catch(const gpstk::Exception& e)
|
||||
{
|
||||
}
|
||||
catch (const gpstk::Exception& e)
|
||||
{
|
||||
std::cout << e;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
{
|
||||
std::cout << "unknown error. I don't feel so well..." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
std::string arg2_gen = std::string("./") + ObsGpsL1SystemTest::generated_rinex_obs;
|
||||
gpstk::Rinex3ObsStream r_meas(arg2_gen);
|
||||
r_meas.exceptions(std::ios::failbit);
|
||||
@@ -444,57 +444,57 @@ void ObsGpsL1SystemTest::check_results()
|
||||
{
|
||||
for (int myprn = 1; myprn < 33; myprn++)
|
||||
{
|
||||
gpstk::SatID prn( myprn, gpstk::SatID::systemGPS );
|
||||
gpstk::SatID prn(myprn, gpstk::SatID::systemGPS);
|
||||
gpstk::CommonTime time = r_meas_data.time;
|
||||
double sow(static_cast<gpstk::GPSWeekSecond>(time).sow);
|
||||
|
||||
gpstk::Rinex3ObsData::DataMap::iterator pointer = r_meas_data.obs.find(prn);
|
||||
if( pointer == r_meas_data.obs.end() )
|
||||
if (pointer == r_meas_data.obs.end())
|
||||
{
|
||||
// PRN not present; do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
dataobj = r_meas_data.getObs(prn, "C1C", r_meas_header);
|
||||
dataobj = r_meas_data.getObs(prn, "C1C", r_meas_header);
|
||||
double P1 = dataobj.data;
|
||||
std::pair<double, double> pseudo(sow, P1);
|
||||
pseudorange_meas.at(myprn).push_back(pseudo);
|
||||
|
||||
dataobj = r_meas_data.getObs(prn, "L1C", r_meas_header);
|
||||
dataobj = r_meas_data.getObs(prn, "L1C", r_meas_header);
|
||||
double L1 = dataobj.data;
|
||||
std::pair<double, double> carrier(sow, L1);
|
||||
carrierphase_meas.at(myprn).push_back(carrier);
|
||||
|
||||
dataobj = r_meas_data.getObs(prn, "D1C", r_meas_header);
|
||||
dataobj = r_meas_data.getObs(prn, "D1C", r_meas_header);
|
||||
double D1 = dataobj.data;
|
||||
std::pair<double, double> doppler(sow, D1);
|
||||
doppler_meas.at(myprn).push_back(doppler);
|
||||
} // End of 'if( pointer == roe.obs.end() )'
|
||||
} // end for
|
||||
} // end while
|
||||
} // End of 'try' block
|
||||
catch(const gpstk::FFStreamError& e)
|
||||
{
|
||||
} // end for
|
||||
} // end while
|
||||
} // End of 'try' block
|
||||
catch (const gpstk::FFStreamError& e)
|
||||
{
|
||||
std::cout << e;
|
||||
exit(1);
|
||||
}
|
||||
catch(const gpstk::Exception& e)
|
||||
{
|
||||
}
|
||||
catch (const gpstk::Exception& e)
|
||||
{
|
||||
std::cout << e;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
{
|
||||
std::cout << "unknown error. I don't feel so well..." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Time alignment
|
||||
std::vector<std::vector<std::pair<double, double>> > pseudorange_ref_aligned(33);
|
||||
std::vector<std::vector<std::pair<double, double>> > carrierphase_ref_aligned(33);
|
||||
std::vector<std::vector<std::pair<double, double>> > doppler_ref_aligned(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> pseudorange_ref_aligned(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> carrierphase_ref_aligned(33);
|
||||
std::vector<std::vector<std::pair<double, double>>> doppler_ref_aligned(33);
|
||||
|
||||
std::vector<std::vector<std::pair<double, double>> >::iterator iter;
|
||||
std::vector<std::vector<std::pair<double, double>>>::iterator iter;
|
||||
std::vector<std::pair<double, double>>::iterator it;
|
||||
std::vector<std::pair<double, double>>::iterator it2;
|
||||
|
||||
@@ -506,17 +506,17 @@ void ObsGpsL1SystemTest::check_results()
|
||||
std::vector<double>::iterator iter_v;
|
||||
|
||||
int prn_id = 0;
|
||||
for(iter = pseudorange_ref.begin(); iter != pseudorange_ref.end(); iter++)
|
||||
for (iter = pseudorange_ref.begin(); iter != pseudorange_ref.end(); iter++)
|
||||
{
|
||||
for(it = iter->begin(); it != iter->end(); it++)
|
||||
for (it = iter->begin(); it != iter->end(); it++)
|
||||
{
|
||||
// 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++)
|
||||
for (it2 = pseudorange_meas.at(prn_id).begin(); it2 != pseudorange_meas.at(prn_id).end(); it2++)
|
||||
{
|
||||
if(std::abs(it->first - it2->first) < 0.1) // store measures closer than 10 ms.
|
||||
if (std::abs(it->first - it2->first) < 0.1) // 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 );
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -525,17 +525,17 @@ void ObsGpsL1SystemTest::check_results()
|
||||
}
|
||||
|
||||
prn_id = 0;
|
||||
for(iter = carrierphase_ref.begin(); iter != carrierphase_ref.end(); iter++)
|
||||
for (iter = carrierphase_ref.begin(); iter != carrierphase_ref.end(); iter++)
|
||||
{
|
||||
for(it = iter->begin(); it != iter->end(); it++)
|
||||
for (it = iter->begin(); it != iter->end(); it++)
|
||||
{
|
||||
// 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++)
|
||||
for (it2 = carrierphase_meas.at(prn_id).begin(); it2 != carrierphase_meas.at(prn_id).end(); it2++)
|
||||
{
|
||||
if(std::abs(it->first - it2->first) < 0.1) // store measures closer than 10 ms.
|
||||
if (std::abs(it->first - it2->first) < 0.1) // 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 );
|
||||
cp_diff.at(prn_id).push_back(it->second - it2->second);
|
||||
// std::cout << "Sat " << prn_id << ": " << "Carrier_ref=" << it->second << " Carrier_meas=" << it2->second << " Diff:" << it->second - it2->second << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -543,17 +543,17 @@ void ObsGpsL1SystemTest::check_results()
|
||||
prn_id++;
|
||||
}
|
||||
prn_id = 0;
|
||||
for(iter = doppler_ref.begin(); iter != doppler_ref.end(); iter++)
|
||||
for (iter = doppler_ref.begin(); iter != doppler_ref.end(); iter++)
|
||||
{
|
||||
for(it = iter->begin(); it != iter->end(); it++)
|
||||
for (it = iter->begin(); it != iter->end(); it++)
|
||||
{
|
||||
// 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++)
|
||||
for (it2 = doppler_meas.at(prn_id).begin(); it2 != doppler_meas.at(prn_id).end(); it2++)
|
||||
{
|
||||
if(std::abs(it->first - it2->first) < 0.01) // store measures closer than 10 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 );
|
||||
doppler_diff.at(prn_id).push_back(it->second - it2->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -563,23 +563,23 @@ void ObsGpsL1SystemTest::check_results()
|
||||
// Compute pseudorange error
|
||||
prn_id = 0;
|
||||
std::vector<double> mean_pr_diff_v;
|
||||
for(iter_diff = pr_diff.begin(); iter_diff != pr_diff.end(); iter_diff++)
|
||||
for (iter_diff = pr_diff.begin(); iter_diff != pr_diff.end(); iter_diff++)
|
||||
{
|
||||
// For each satellite with reference and measurements aligned in time
|
||||
int number_obs = 0;
|
||||
double mean_diff = 0.0;
|
||||
for(iter_v = iter_diff->begin(); iter_v != iter_diff->end(); iter_v++)
|
||||
for (iter_v = iter_diff->begin(); iter_v != iter_diff->end(); iter_v++)
|
||||
{
|
||||
mean_diff = mean_diff + *iter_v;
|
||||
number_obs = number_obs + 1;
|
||||
}
|
||||
if(number_obs > 0)
|
||||
if (number_obs > 0)
|
||||
{
|
||||
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;
|
||||
double stdev_ = compute_stdev(*iter_diff);
|
||||
std::cout << " +/- " << stdev_ ;
|
||||
std::cout << " +/- " << stdev_;
|
||||
std::cout << " [m]" << std::endl;
|
||||
}
|
||||
else
|
||||
@@ -596,17 +596,17 @@ void ObsGpsL1SystemTest::check_results()
|
||||
// Compute carrier phase error
|
||||
prn_id = 0;
|
||||
std::vector<double> mean_cp_diff_v;
|
||||
for(iter_diff = cp_diff.begin(); iter_diff != cp_diff.end(); iter_diff++)
|
||||
for (iter_diff = cp_diff.begin(); iter_diff != cp_diff.end(); iter_diff++)
|
||||
{
|
||||
// For each satellite with reference and measurements aligned in time
|
||||
int number_obs = 0;
|
||||
double mean_diff = 0.0;
|
||||
for(iter_v = iter_diff->begin(); iter_v != iter_diff->end(); iter_v++)
|
||||
for (iter_v = iter_diff->begin(); iter_v != iter_diff->end(); iter_v++)
|
||||
{
|
||||
mean_diff = mean_diff + *iter_v;
|
||||
number_obs = number_obs + 1;
|
||||
}
|
||||
if(number_obs > 0)
|
||||
if (number_obs > 0)
|
||||
{
|
||||
mean_diff = mean_diff / number_obs;
|
||||
mean_cp_diff_v.push_back(mean_diff);
|
||||
@@ -625,18 +625,18 @@ void ObsGpsL1SystemTest::check_results()
|
||||
// Compute Doppler error
|
||||
prn_id = 0;
|
||||
std::vector<double> mean_doppler_v;
|
||||
for(iter_diff = doppler_diff.begin(); iter_diff != doppler_diff.end(); iter_diff++)
|
||||
for (iter_diff = doppler_diff.begin(); iter_diff != doppler_diff.end(); iter_diff++)
|
||||
{
|
||||
// For each satellite with reference and measurements aligned in time
|
||||
int number_obs = 0;
|
||||
double mean_diff = 0.0;
|
||||
for(iter_v = iter_diff->begin(); iter_v != iter_diff->end(); iter_v++)
|
||||
for (iter_v = iter_diff->begin(); iter_v != iter_diff->end(); iter_v++)
|
||||
{
|
||||
//std::cout << *iter_v << std::endl;
|
||||
mean_diff = mean_diff + *iter_v;
|
||||
number_obs = number_obs + 1;
|
||||
}
|
||||
if(number_obs > 0)
|
||||
if (number_obs > 0)
|
||||
{
|
||||
mean_diff = mean_diff / number_obs;
|
||||
mean_doppler_v.push_back(mean_diff);
|
||||
@@ -667,13 +667,13 @@ TEST_F(ObsGpsL1SystemTest, Observables_system_test)
|
||||
configure_generator();
|
||||
|
||||
// Generate signal raw signal samples and observations RINEX file
|
||||
if(!FLAGS_disable_generator)
|
||||
if (!FLAGS_disable_generator)
|
||||
{
|
||||
generate_signal();
|
||||
}
|
||||
|
||||
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);
|
||||
bool is_gen_rinex_obs_valid = check_valid_rinex_obs("./" + FLAGS_filename_rinex_obs);
|
||||
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;
|
||||
|
||||
@@ -681,10 +681,10 @@ TEST_F(ObsGpsL1SystemTest, Observables_system_test)
|
||||
configure_receiver();
|
||||
|
||||
// Run the receiver
|
||||
EXPECT_EQ( run_receiver(), 0) << "Problem executing the software-defined signal generator";
|
||||
EXPECT_EQ(run_receiver(), 0) << "Problem executing the software-defined signal generator";
|
||||
|
||||
std::cout << "Validating RINEX obs file obtained by GNSS-SDR: " << ObsGpsL1SystemTest::generated_rinex_obs << " ..." << std::endl;
|
||||
is_gen_rinex_obs_valid = check_valid_rinex_obs( "./" + ObsGpsL1SystemTest::generated_rinex_obs);
|
||||
is_gen_rinex_obs_valid = check_valid_rinex_obs("./" + ObsGpsL1SystemTest::generated_rinex_obs);
|
||||
EXPECT_EQ(true, is_gen_rinex_obs_valid) << "The RINEX observation file " << ObsGpsL1SystemTest::generated_rinex_obs << ", generated by GNSS-SDR, is not well formed.";
|
||||
std::cout << "The file is valid." << std::endl;
|
||||
|
||||
@@ -693,28 +693,30 @@ TEST_F(ObsGpsL1SystemTest, Observables_system_test)
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::cout << "Running Observables validation test..." << std::endl;
|
||||
int res = 0;
|
||||
try
|
||||
{
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
}
|
||||
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
// Run the Tests
|
||||
try
|
||||
{
|
||||
{
|
||||
res = RUN_ALL_TESTS();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG(WARNING) << "Unexpected catch";
|
||||
}
|
||||
}
|
||||
google::ShutDownCommandLineFlags();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ DEFINE_double(dp_error_mean_max, 75.0, "Maximum mean error in Doppler frequency"
|
||||
DEFINE_double(dp_error_std_max, 25.0, "Maximum standard deviation in Doppler frequency");
|
||||
DEFINE_bool(plot_obs_sys_test, false, "Plots results of ObsSystemTest with gnuplot");
|
||||
|
||||
class ObsSystemTest: public ::testing::Test
|
||||
class ObsSystemTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
int configure_receiver();
|
||||
@@ -79,38 +79,38 @@ public:
|
||||
void check_results();
|
||||
bool check_valid_rinex_obs(std::string filename, int rinex_ver); // return true if the file is a valid Rinex observation file.
|
||||
void read_rinex_files(
|
||||
std::vector<arma::mat>& pseudorange_ref,
|
||||
std::vector<arma::mat>& carrierphase_ref,
|
||||
std::vector<arma::mat>& doppler_ref,
|
||||
std::vector<arma::mat>& pseudorange_meas,
|
||||
std::vector<arma::mat>& carrierphase_meas,
|
||||
std::vector<arma::mat>& doppler_meas,
|
||||
arma::mat& sow_prn_ref,
|
||||
int signal_type);
|
||||
std::vector<arma::mat>& pseudorange_ref,
|
||||
std::vector<arma::mat>& carrierphase_ref,
|
||||
std::vector<arma::mat>& doppler_ref,
|
||||
std::vector<arma::mat>& pseudorange_meas,
|
||||
std::vector<arma::mat>& carrierphase_meas,
|
||||
std::vector<arma::mat>& doppler_meas,
|
||||
arma::mat& sow_prn_ref,
|
||||
int signal_type);
|
||||
void time_alignment_diff(
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff);
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff);
|
||||
void time_alignment_diff_cp(
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff);
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff);
|
||||
void time_alignment_diff_pr(
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff,
|
||||
arma::mat& sow_prn_ref);
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff,
|
||||
arma::mat& sow_prn_ref);
|
||||
void compute_pseudorange_error(std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name);
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name);
|
||||
void compute_carrierphase_error(
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name);
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name);
|
||||
void compute_doppler_error(
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name);
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name);
|
||||
std::string filename_rinex_obs = FLAGS_filename_rinex_true;
|
||||
std::string generated_rinex_obs = FLAGS_filename_rinex_obs;
|
||||
std::string configuration_file_ = FLAGS_configuration_file;
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
const int num_prn_gal = 31;
|
||||
|
||||
double pseudorange_error_th_mean = FLAGS_pr_error_mean_max;
|
||||
double pseudorange_error_th_std= FLAGS_pr_error_std_max;
|
||||
double pseudorange_error_th_std = FLAGS_pr_error_std_max;
|
||||
double carrierphase_error_th_mean = FLAGS_cp_error_mean_max;
|
||||
double carrierphase_error_th_std = FLAGS_cp_error_std_max;
|
||||
double doppler_error_th_mean = FLAGS_dp_error_mean_max;
|
||||
@@ -137,11 +137,11 @@ public:
|
||||
bool ObsSystemTest::check_valid_rinex_obs(std::string filename, int rinex_ver)
|
||||
{
|
||||
bool res = false;
|
||||
if(rinex_ver == 2)
|
||||
if (rinex_ver == 2)
|
||||
{
|
||||
res = gpstk::isRinexObsFile(filename);
|
||||
}
|
||||
if(rinex_ver == 3)
|
||||
if (rinex_ver == 3)
|
||||
{
|
||||
res = gpstk::isRinex3ObsFile(filename);
|
||||
}
|
||||
@@ -150,14 +150,14 @@ bool ObsSystemTest::check_valid_rinex_obs(std::string filename, int rinex_ver)
|
||||
|
||||
|
||||
void ObsSystemTest::read_rinex_files(
|
||||
std::vector<arma::mat>& pseudorange_ref,
|
||||
std::vector<arma::mat>& carrierphase_ref,
|
||||
std::vector<arma::mat>& doppler_ref,
|
||||
std::vector<arma::mat>& pseudorange_meas,
|
||||
std::vector<arma::mat>& carrierphase_meas,
|
||||
std::vector<arma::mat>& doppler_meas,
|
||||
arma::mat& sow_prn_ref,
|
||||
int signal_type)
|
||||
std::vector<arma::mat>& pseudorange_ref,
|
||||
std::vector<arma::mat>& carrierphase_ref,
|
||||
std::vector<arma::mat>& doppler_ref,
|
||||
std::vector<arma::mat>& pseudorange_meas,
|
||||
std::vector<arma::mat>& carrierphase_meas,
|
||||
std::vector<arma::mat>& doppler_meas,
|
||||
arma::mat& sow_prn_ref,
|
||||
int signal_type)
|
||||
{
|
||||
bool ref_exist = false;
|
||||
bool meas_exist = false;
|
||||
@@ -169,53 +169,53 @@ void ObsSystemTest::read_rinex_files(
|
||||
std::string signal_type_string;
|
||||
sow_prn_ref.reset();
|
||||
|
||||
switch(signal_type)
|
||||
{
|
||||
case 0: //GPS L1
|
||||
switch (signal_type)
|
||||
{
|
||||
case 0: //GPS L1
|
||||
|
||||
sat_type = gpstk::SatID::systemGPS;
|
||||
max_prn = num_prn_gps;
|
||||
pr_string = "C1C";
|
||||
cp_string = "L1C";
|
||||
dp_string = "D1C";
|
||||
signal_type_string = "GPS L1 C/A";
|
||||
break;
|
||||
sat_type = gpstk::SatID::systemGPS;
|
||||
max_prn = num_prn_gps;
|
||||
pr_string = "C1C";
|
||||
cp_string = "L1C";
|
||||
dp_string = "D1C";
|
||||
signal_type_string = "GPS L1 C/A";
|
||||
break;
|
||||
|
||||
case 1: //Galileo E1B
|
||||
case 1: //Galileo E1B
|
||||
|
||||
sat_type = gpstk::SatID::systemGalileo;
|
||||
max_prn = num_prn_gal;
|
||||
pr_string = "C1B";
|
||||
cp_string = "L1B";
|
||||
dp_string = "D1B";
|
||||
signal_type_string = "Galileo E1B";
|
||||
break;
|
||||
sat_type = gpstk::SatID::systemGalileo;
|
||||
max_prn = num_prn_gal;
|
||||
pr_string = "C1B";
|
||||
cp_string = "L1B";
|
||||
dp_string = "D1B";
|
||||
signal_type_string = "Galileo E1B";
|
||||
break;
|
||||
|
||||
case 2: //GPS L5
|
||||
case 2: //GPS L5
|
||||
|
||||
sat_type = gpstk::SatID::systemGPS;
|
||||
max_prn = num_prn_gps;
|
||||
pr_string = "C5X";
|
||||
cp_string = "L5X";
|
||||
dp_string = "D5X";
|
||||
signal_type_string = "GPS L5";
|
||||
break;
|
||||
sat_type = gpstk::SatID::systemGPS;
|
||||
max_prn = num_prn_gps;
|
||||
pr_string = "C5X";
|
||||
cp_string = "L5X";
|
||||
dp_string = "D5X";
|
||||
signal_type_string = "GPS L5";
|
||||
break;
|
||||
|
||||
case 3: //Galileo E5a
|
||||
case 3: //Galileo E5a
|
||||
|
||||
sat_type = gpstk::SatID::systemGalileo;
|
||||
max_prn = num_prn_gal;
|
||||
pr_string = "C5X";
|
||||
cp_string = "L5X";
|
||||
dp_string = "D5X";
|
||||
signal_type_string = "Galileo E5a";
|
||||
break;
|
||||
}
|
||||
sat_type = gpstk::SatID::systemGalileo;
|
||||
max_prn = num_prn_gal;
|
||||
pr_string = "C5X";
|
||||
cp_string = "L5X";
|
||||
dp_string = "D5X";
|
||||
signal_type_string = "Galileo E5a";
|
||||
break;
|
||||
}
|
||||
|
||||
// Open and read reference RINEX observables file
|
||||
std::cout << "Read: RINEX " << signal_type_string << " True" << std::endl;
|
||||
try
|
||||
{
|
||||
{
|
||||
gpstk::Rinex3ObsStream r_ref(filename_rinex_obs);
|
||||
r_ref.exceptions(std::ios::failbit);
|
||||
gpstk::Rinex3ObsData r_ref_data;
|
||||
@@ -227,55 +227,55 @@ void ObsSystemTest::read_rinex_files(
|
||||
{
|
||||
for (int myprn = 1; myprn < max_prn; myprn++)
|
||||
{
|
||||
gpstk::SatID prn( myprn, sat_type);
|
||||
gpstk::SatID prn(myprn, sat_type);
|
||||
gpstk::CommonTime time = r_ref_data.time;
|
||||
double sow(static_cast<gpstk::GPSWeekSecond>(time).sow);
|
||||
gpstk::Rinex3ObsData::DataMap::iterator pointer = r_ref_data.obs.find(prn);
|
||||
if( pointer == r_ref_data.obs.end() )
|
||||
if (pointer == r_ref_data.obs.end())
|
||||
{
|
||||
// PRN not present; do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
dataobj = r_ref_data.getObs(prn, pr_string, r_ref_header);
|
||||
dataobj = r_ref_data.getObs(prn, pr_string, r_ref_header);
|
||||
double P1 = dataobj.data;
|
||||
pseudorange_ref.at(myprn).insert_rows(pseudorange_ref.at(myprn).n_rows, arma::rowvec({sow, P1}));
|
||||
|
||||
dataobj = r_ref_data.getObs(prn, cp_string, r_ref_header);
|
||||
dataobj = r_ref_data.getObs(prn, cp_string, r_ref_header);
|
||||
double L1 = dataobj.data;
|
||||
carrierphase_ref.at(myprn).insert_rows(carrierphase_ref.at(myprn).n_rows, arma::rowvec({sow, L1}));
|
||||
|
||||
dataobj = r_ref_data.getObs(prn, dp_string, r_ref_header);
|
||||
dataobj = r_ref_data.getObs(prn, dp_string, r_ref_header);
|
||||
double D1 = dataobj.data;
|
||||
doppler_ref.at(myprn).insert_rows(doppler_ref.at(myprn).n_rows, arma::rowvec({sow, D1}));
|
||||
|
||||
ref_exist = true;
|
||||
} // End of 'if( pointer == roe.obs.end() )'
|
||||
} // end for
|
||||
} // end while
|
||||
} // End of 'try' block
|
||||
catch(const gpstk::FFStreamError& e)
|
||||
{
|
||||
} // end for
|
||||
} // end while
|
||||
} // End of 'try' block
|
||||
catch (const gpstk::FFStreamError& e)
|
||||
{
|
||||
std::cout << e;
|
||||
exit(1);
|
||||
}
|
||||
catch(const gpstk::Exception& e)
|
||||
{
|
||||
}
|
||||
catch (const gpstk::Exception& e)
|
||||
{
|
||||
std::cout << e;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
{
|
||||
std::cout << "unknown error. I don't feel so well..." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Open and read measured RINEX observables file
|
||||
std::cout << "Read: RINEX "<< signal_type_string << " measures" << std::endl;
|
||||
std::cout << "Read: RINEX " << signal_type_string << " measures" << std::endl;
|
||||
try
|
||||
{
|
||||
{
|
||||
std::string arg2_gen;
|
||||
if(internal_rinex_generation)
|
||||
if (internal_rinex_generation)
|
||||
{
|
||||
arg2_gen = std::string("./") + generated_rinex_obs;
|
||||
}
|
||||
@@ -298,20 +298,20 @@ void ObsSystemTest::read_rinex_files(
|
||||
bool set_pr_min = true;
|
||||
for (int myprn = 1; myprn < max_prn; myprn++)
|
||||
{
|
||||
gpstk::SatID prn( myprn, sat_type);
|
||||
gpstk::SatID prn(myprn, sat_type);
|
||||
gpstk::CommonTime time = r_meas_data.time;
|
||||
double sow(static_cast<gpstk::GPSWeekSecond>(time).sow);
|
||||
gpstk::Rinex3ObsData::DataMap::iterator pointer = r_meas_data.obs.find(prn);
|
||||
if( pointer == r_meas_data.obs.end() )
|
||||
if (pointer == r_meas_data.obs.end())
|
||||
{
|
||||
// PRN not present; do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
dataobj = r_meas_data.getObs(prn, pr_string, r_meas_header);
|
||||
dataobj = r_meas_data.getObs(prn, pr_string, r_meas_header);
|
||||
double P1 = dataobj.data;
|
||||
pseudorange_meas.at(myprn).insert_rows(pseudorange_meas.at(myprn).n_rows, arma::rowvec({sow, P1}));
|
||||
if(set_pr_min || (P1 < pr_min))
|
||||
if (set_pr_min || (P1 < pr_min))
|
||||
{
|
||||
set_pr_min = false;
|
||||
pr_min = P1;
|
||||
@@ -319,47 +319,47 @@ void ObsSystemTest::read_rinex_files(
|
||||
prn_min = static_cast<double>(myprn);
|
||||
}
|
||||
|
||||
dataobj = r_meas_data.getObs(prn, cp_string, r_meas_header);
|
||||
dataobj = r_meas_data.getObs(prn, cp_string, r_meas_header);
|
||||
double L1 = dataobj.data;
|
||||
carrierphase_meas.at(myprn).insert_rows(carrierphase_meas.at(myprn).n_rows, arma::rowvec({sow, L1}));
|
||||
|
||||
dataobj = r_meas_data.getObs(prn, dp_string, r_meas_header);
|
||||
dataobj = r_meas_data.getObs(prn, dp_string, r_meas_header);
|
||||
double D1 = dataobj.data;
|
||||
doppler_meas.at(myprn).insert_rows(doppler_meas.at(myprn).n_rows, arma::rowvec({sow, D1}));
|
||||
|
||||
meas_exist = true;
|
||||
} // End of 'if( pointer == roe.obs.end() )'
|
||||
} // end for
|
||||
} // end for
|
||||
if (!set_pr_min)
|
||||
{
|
||||
sow_prn_ref.insert_rows(sow_prn_ref.n_rows, arma::rowvec({sow_insert, pr_min, prn_min}));
|
||||
sow_prn_ref.insert_rows(sow_prn_ref.n_rows, arma::rowvec({sow_insert, pr_min, prn_min}));
|
||||
}
|
||||
} // end while
|
||||
} // End of 'try' block
|
||||
catch(const gpstk::FFStreamError& e)
|
||||
{
|
||||
} // end while
|
||||
} // End of 'try' block
|
||||
catch (const gpstk::FFStreamError& e)
|
||||
{
|
||||
std::cout << e;
|
||||
exit(1);
|
||||
}
|
||||
catch(const gpstk::Exception& e)
|
||||
{
|
||||
}
|
||||
catch (const gpstk::Exception& e)
|
||||
{
|
||||
std::cout << e;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
{
|
||||
std::cout << "unknown error. I don't feel so well..." << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(ref_exist) << "RINEX reference file does not contain " << signal_type_string << " information";
|
||||
EXPECT_TRUE(meas_exist) << "RINEX generated file does not contain " << signal_type_string << " information";
|
||||
}
|
||||
|
||||
|
||||
void ObsSystemTest::time_alignment_diff(
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff)
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff)
|
||||
{
|
||||
std::vector<arma::mat>::iterator iter_ref;
|
||||
std::vector<arma::mat>::iterator iter_meas;
|
||||
@@ -368,9 +368,9 @@ void ObsSystemTest::time_alignment_diff(
|
||||
|
||||
iter_ref = ref.begin();
|
||||
iter_diff = diff.begin();
|
||||
for(iter_meas = meas.begin(); iter_meas != meas.end(); iter_meas++)
|
||||
for (iter_meas = meas.begin(); iter_meas != meas.end(); iter_meas++)
|
||||
{
|
||||
if( !iter_meas->is_empty() && !iter_ref->is_empty() )
|
||||
if (!iter_meas->is_empty() && !iter_ref->is_empty())
|
||||
{
|
||||
arma::uvec index_ = arma::find(iter_meas->col(0) > iter_ref->at(0, 0));
|
||||
arma::uword index_min = arma::min(index_);
|
||||
@@ -388,9 +388,9 @@ void ObsSystemTest::time_alignment_diff(
|
||||
|
||||
|
||||
void ObsSystemTest::time_alignment_diff_cp(
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff)
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff)
|
||||
{
|
||||
std::vector<arma::mat>::iterator iter_ref;
|
||||
std::vector<arma::mat>::iterator iter_meas;
|
||||
@@ -399,9 +399,9 @@ void ObsSystemTest::time_alignment_diff_cp(
|
||||
|
||||
iter_ref = ref.begin();
|
||||
iter_diff = diff.begin();
|
||||
for(iter_meas = meas.begin(); iter_meas != meas.end(); iter_meas++)
|
||||
for (iter_meas = meas.begin(); iter_meas != meas.end(); iter_meas++)
|
||||
{
|
||||
if( !iter_meas->is_empty() && !iter_ref->is_empty() )
|
||||
if (!iter_meas->is_empty() && !iter_ref->is_empty())
|
||||
{
|
||||
arma::uvec index_ = arma::find(iter_meas->col(0) > iter_ref->at(0, 0));
|
||||
arma::uword index_min = arma::min(index_);
|
||||
@@ -421,10 +421,10 @@ void ObsSystemTest::time_alignment_diff_cp(
|
||||
|
||||
|
||||
void ObsSystemTest::time_alignment_diff_pr(
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff,
|
||||
arma::mat& sow_prn_ref)
|
||||
std::vector<arma::mat>& ref,
|
||||
std::vector<arma::mat>& meas,
|
||||
std::vector<arma::vec>& diff,
|
||||
arma::mat& sow_prn_ref)
|
||||
{
|
||||
std::vector<arma::mat>::iterator iter_ref;
|
||||
std::vector<arma::mat>::iterator iter_meas;
|
||||
@@ -438,14 +438,14 @@ void ObsSystemTest::time_alignment_diff_pr(
|
||||
arma::vec::iterator iter_vec1 = subtraction_pr_ref.begin_col(1);
|
||||
arma::vec::iterator iter_vec2 = subtraction_pr_ref.begin_col(2);
|
||||
|
||||
for(iter_vec1 = subtraction_pr_ref.begin_col(1); iter_vec1 != subtraction_pr_ref.end_col(1); iter_vec1++)
|
||||
for (iter_vec1 = subtraction_pr_ref.begin_col(1); iter_vec1 != subtraction_pr_ref.end_col(1); iter_vec1++)
|
||||
{
|
||||
arma::vec aux_pr; //vector with only 1 element
|
||||
arma::vec aux_sow = {*iter_vec0}; //vector with only 1 element
|
||||
arma::vec aux_pr; //vector with only 1 element
|
||||
arma::vec aux_sow = {*iter_vec0}; //vector with only 1 element
|
||||
arma::interp1(ref.at(static_cast<int>(*iter_vec2)).col(0),
|
||||
ref.at(static_cast<int>(*iter_vec2)).col(1),
|
||||
aux_sow,
|
||||
aux_pr);
|
||||
ref.at(static_cast<int>(*iter_vec2)).col(1),
|
||||
aux_sow,
|
||||
aux_pr);
|
||||
*iter_vec1 = aux_pr(0);
|
||||
iter_vec0++;
|
||||
iter_vec2++;
|
||||
@@ -453,9 +453,9 @@ void ObsSystemTest::time_alignment_diff_pr(
|
||||
|
||||
iter_ref = ref.begin();
|
||||
iter_diff = diff.begin();
|
||||
for(iter_meas = meas.begin(); iter_meas != meas.end(); iter_meas++)
|
||||
for (iter_meas = meas.begin(); iter_meas != meas.end(); iter_meas++)
|
||||
{
|
||||
if( !iter_meas->is_empty() && !iter_ref->is_empty() )
|
||||
if (!iter_meas->is_empty() && !iter_ref->is_empty())
|
||||
{
|
||||
arma::uvec index_ = arma::find(iter_meas->col(0) > iter_ref->at(0, 0));
|
||||
arma::uword index_min = arma::min(index_);
|
||||
@@ -480,14 +480,22 @@ int ObsSystemTest::configure_receiver()
|
||||
{
|
||||
config = std::make_shared<FileConfiguration>(configuration_file_);
|
||||
|
||||
if( config->property("Channels_1C.count", 0) > 0 )
|
||||
{gps_1C = true;}
|
||||
if( config->property("Channels_1B.count", 0) > 0 )
|
||||
{gal_1B = true;}
|
||||
if( config->property("Channels_5X.count", 0) > 0 )
|
||||
{gal_E5a = true;}
|
||||
if( config->property("Channels_7X.count", 0) > 0 ) //NOT DEFINITIVE!!!!!
|
||||
{gps_L5 = true;}
|
||||
if (config->property("Channels_1C.count", 0) > 0)
|
||||
{
|
||||
gps_1C = true;
|
||||
}
|
||||
if (config->property("Channels_1B.count", 0) > 0)
|
||||
{
|
||||
gal_1B = true;
|
||||
}
|
||||
if (config->property("Channels_5X.count", 0) > 0)
|
||||
{
|
||||
gal_E5a = true;
|
||||
}
|
||||
if (config->property("Channels_7X.count", 0) > 0) //NOT DEFINITIVE!!!!!
|
||||
{
|
||||
gps_L5 = true;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -499,20 +507,20 @@ int ObsSystemTest::run_receiver()
|
||||
control_thread = std::make_shared<ControlThread>(config);
|
||||
// start receiver
|
||||
try
|
||||
{
|
||||
{
|
||||
control_thread->run();
|
||||
}
|
||||
catch(const boost::exception & e)
|
||||
{
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
// Get the name of the RINEX obs file generated by the receiver
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
FILE *fp;
|
||||
FILE* fp;
|
||||
std::string argum2 = std::string("/bin/ls *O | grep GSDR | tail -1");
|
||||
char buffer[1035];
|
||||
fp = popen(&argum2[0], "r");
|
||||
@@ -533,33 +541,33 @@ int ObsSystemTest::run_receiver()
|
||||
|
||||
|
||||
void ObsSystemTest::compute_pseudorange_error(
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name)
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name)
|
||||
{
|
||||
int prn_id = 0;
|
||||
std::vector<arma::vec>::iterator iter_diff;
|
||||
std::vector<double> means;
|
||||
std::vector<double> stddevs;
|
||||
std::vector<double> prns;
|
||||
for(iter_diff = diff.begin(); iter_diff != diff.end(); iter_diff++)
|
||||
for (iter_diff = diff.begin(); iter_diff != diff.end(); iter_diff++)
|
||||
{
|
||||
if(!iter_diff->is_empty())
|
||||
if (!iter_diff->is_empty())
|
||||
{
|
||||
while(iter_diff->has_nan())
|
||||
while (iter_diff->has_nan())
|
||||
{
|
||||
bool nan_found = false;
|
||||
int k_aux = 0;
|
||||
while(!nan_found)
|
||||
while (!nan_found)
|
||||
{
|
||||
if(!iter_diff->row(k_aux).is_finite())
|
||||
if (!iter_diff->row(k_aux).is_finite())
|
||||
{
|
||||
nan_found = true;
|
||||
iter_diff->shed_row(k_aux);
|
||||
nan_found = true;
|
||||
iter_diff->shed_row(k_aux);
|
||||
}
|
||||
k_aux++;
|
||||
}
|
||||
}
|
||||
}
|
||||
double d_mean = std::sqrt(arma::mean(arma::square(*iter_diff)));
|
||||
means.push_back(d_mean);
|
||||
double d_stddev = arma::stddev(*iter_diff);
|
||||
@@ -573,10 +581,10 @@ void ObsSystemTest::compute_pseudorange_error(
|
||||
}
|
||||
prn_id++;
|
||||
}
|
||||
if(FLAGS_plot_obs_sys_test == true)
|
||||
if (FLAGS_plot_obs_sys_test == true)
|
||||
{
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_obs_sys_test has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -585,7 +593,7 @@ void ObsSystemTest::compute_pseudorange_error(
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -599,58 +607,58 @@ void ObsSystemTest::compute_pseudorange_error(
|
||||
g1.plot_xy(prns, means, "RMS error");
|
||||
g1.plot_xy(prns, stddevs, "Standard deviation");
|
||||
size_t char_pos = signal_name.find(" ");
|
||||
while(char_pos != std::string::npos)
|
||||
while (char_pos != std::string::npos)
|
||||
{
|
||||
signal_name.replace(char_pos, 1, "_");
|
||||
char_pos = signal_name.find(" ");
|
||||
}
|
||||
char_pos = signal_name.find("/");
|
||||
while(char_pos != std::string::npos)
|
||||
while (char_pos != std::string::npos)
|
||||
{
|
||||
signal_name.replace(char_pos, 1, "_");
|
||||
char_pos = signal_name.find("/");
|
||||
}
|
||||
g1.savetops("Pseudorange_error_" + signal_name);
|
||||
g1.savetopdf("Pseudorange_error_" + signal_name, 18);
|
||||
g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObsSystemTest::compute_carrierphase_error(
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name)
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name)
|
||||
{
|
||||
int prn_id = 0;
|
||||
std::vector<double> means;
|
||||
std::vector<double> stddevs;
|
||||
std::vector<double> prns;
|
||||
std::vector<arma::vec>::iterator iter_diff;
|
||||
for(iter_diff = diff.begin(); iter_diff != diff.end(); iter_diff++)
|
||||
for (iter_diff = diff.begin(); iter_diff != diff.end(); iter_diff++)
|
||||
{
|
||||
if(!iter_diff->is_empty())
|
||||
if (!iter_diff->is_empty())
|
||||
{
|
||||
while(iter_diff->has_nan())
|
||||
while (iter_diff->has_nan())
|
||||
{
|
||||
bool nan_found = false;
|
||||
int k_aux = 0;
|
||||
while(!nan_found)
|
||||
while (!nan_found)
|
||||
{
|
||||
if(!iter_diff->row(k_aux).is_finite())
|
||||
if (!iter_diff->row(k_aux).is_finite())
|
||||
{
|
||||
nan_found = true;
|
||||
iter_diff->shed_row(k_aux);
|
||||
nan_found = true;
|
||||
iter_diff->shed_row(k_aux);
|
||||
}
|
||||
k_aux++;
|
||||
}
|
||||
}
|
||||
}
|
||||
double d_mean = std::sqrt(arma::mean(arma::square(*iter_diff)));
|
||||
means.push_back(d_mean);
|
||||
double d_stddev = arma::stddev(*iter_diff);
|
||||
@@ -664,10 +672,10 @@ void ObsSystemTest::compute_carrierphase_error(
|
||||
}
|
||||
prn_id++;
|
||||
}
|
||||
if(FLAGS_plot_obs_sys_test == true)
|
||||
if (FLAGS_plot_obs_sys_test == true)
|
||||
{
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_obs_sys_test has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -676,7 +684,7 @@ void ObsSystemTest::compute_carrierphase_error(
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -690,58 +698,58 @@ void ObsSystemTest::compute_carrierphase_error(
|
||||
g1.plot_xy(prns, means, "RMS error");
|
||||
g1.plot_xy(prns, stddevs, "Standard deviation");
|
||||
size_t char_pos = signal_name.find(" ");
|
||||
while(char_pos != std::string::npos)
|
||||
while (char_pos != std::string::npos)
|
||||
{
|
||||
signal_name.replace(char_pos, 1, "_");
|
||||
char_pos = signal_name.find(" ");
|
||||
}
|
||||
char_pos = signal_name.find("/");
|
||||
while(char_pos != std::string::npos)
|
||||
while (char_pos != std::string::npos)
|
||||
{
|
||||
signal_name.replace(char_pos, 1, "_");
|
||||
char_pos = signal_name.find("/");
|
||||
}
|
||||
g1.savetops("Carrier_phase_error_" + signal_name);
|
||||
g1.savetopdf("Carrier_phase_error_" + signal_name, 18);
|
||||
g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ObsSystemTest::compute_doppler_error(
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name)
|
||||
std::vector<arma::vec>& diff,
|
||||
double error_th_mean, double error_th_std,
|
||||
std::string signal_name)
|
||||
{
|
||||
int prn_id = 0;
|
||||
std::vector<double> means;
|
||||
std::vector<double> stddevs;
|
||||
std::vector<double> prns;
|
||||
std::vector<arma::vec>::iterator iter_diff;
|
||||
for(iter_diff = diff.begin(); iter_diff != diff.end(); iter_diff++)
|
||||
for (iter_diff = diff.begin(); iter_diff != diff.end(); iter_diff++)
|
||||
{
|
||||
if(!iter_diff->is_empty())
|
||||
if (!iter_diff->is_empty())
|
||||
{
|
||||
while(iter_diff->has_nan())
|
||||
while (iter_diff->has_nan())
|
||||
{
|
||||
bool nan_found = false;
|
||||
int k_aux = 0;
|
||||
while(!nan_found)
|
||||
while (!nan_found)
|
||||
{
|
||||
if(!iter_diff->row(k_aux).is_finite())
|
||||
if (!iter_diff->row(k_aux).is_finite())
|
||||
{
|
||||
nan_found = true;
|
||||
iter_diff->shed_row(k_aux);
|
||||
nan_found = true;
|
||||
iter_diff->shed_row(k_aux);
|
||||
}
|
||||
k_aux++;
|
||||
}
|
||||
}
|
||||
}
|
||||
double d_mean = std::sqrt(arma::mean(arma::square(*iter_diff)));
|
||||
means.push_back(d_mean);
|
||||
double d_stddev = arma::stddev(*iter_diff);
|
||||
@@ -755,10 +763,10 @@ void ObsSystemTest::compute_doppler_error(
|
||||
}
|
||||
prn_id++;
|
||||
}
|
||||
if(FLAGS_plot_obs_sys_test == true)
|
||||
if (FLAGS_plot_obs_sys_test == true)
|
||||
{
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_obs_sys_test has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -767,7 +775,7 @@ void ObsSystemTest::compute_doppler_error(
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -781,25 +789,25 @@ void ObsSystemTest::compute_doppler_error(
|
||||
g1.plot_xy(prns, means, "RMS error");
|
||||
g1.plot_xy(prns, stddevs, "Standard deviation");
|
||||
size_t char_pos = signal_name.find(" ");
|
||||
while(char_pos != std::string::npos)
|
||||
while (char_pos != std::string::npos)
|
||||
{
|
||||
signal_name.replace(char_pos, 1, "_");
|
||||
char_pos = signal_name.find(" ");
|
||||
}
|
||||
char_pos = signal_name.find("/");
|
||||
while(char_pos != std::string::npos)
|
||||
while (char_pos != std::string::npos)
|
||||
{
|
||||
signal_name.replace(char_pos, 1, "_");
|
||||
char_pos = signal_name.find("/");
|
||||
}
|
||||
g1.savetops("Doppler_error_" + signal_name);
|
||||
g1.savetopdf("Doppler_error_" + signal_name, 18);
|
||||
g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -808,7 +816,7 @@ void ObsSystemTest::compute_doppler_error(
|
||||
void ObsSystemTest::check_results()
|
||||
{
|
||||
arma::mat sow_prn_ref;
|
||||
if(gps_1C)
|
||||
if (gps_1C)
|
||||
{
|
||||
std::vector<arma::mat> pseudorange_ref(num_prn_gps);
|
||||
std::vector<arma::mat> carrierphase_ref(num_prn_gps);
|
||||
@@ -846,7 +854,7 @@ void ObsSystemTest::check_results()
|
||||
|
||||
compute_doppler_error(dp_diff, doppler_error_th_mean, doppler_error_th_std, "GPS L1 C/A");
|
||||
}
|
||||
if(gps_L5)
|
||||
if (gps_L5)
|
||||
{
|
||||
std::vector<arma::mat> pseudorange_ref(num_prn_gps);
|
||||
std::vector<arma::mat> carrierphase_ref(num_prn_gps);
|
||||
@@ -884,7 +892,7 @@ void ObsSystemTest::check_results()
|
||||
|
||||
compute_doppler_error(dp_diff, doppler_error_th_mean, doppler_error_th_std, "GPS L5");
|
||||
}
|
||||
if(gal_1B)
|
||||
if (gal_1B)
|
||||
{
|
||||
std::vector<arma::mat> pseudorange_ref(num_prn_gal);
|
||||
std::vector<arma::mat> carrierphase_ref(num_prn_gal);
|
||||
@@ -922,7 +930,7 @@ void ObsSystemTest::check_results()
|
||||
|
||||
compute_doppler_error(dp_diff, doppler_error_th_mean, doppler_error_th_std, "Galileo E1B");
|
||||
}
|
||||
if(gal_E5a)
|
||||
if (gal_E5a)
|
||||
{
|
||||
std::vector<arma::mat> pseudorange_ref(num_prn_gal);
|
||||
std::vector<arma::mat> carrierphase_ref(num_prn_gal);
|
||||
@@ -971,16 +979,16 @@ TEST_F(ObsSystemTest, Observables_system_test)
|
||||
std::cout << "The file is valid." << std::endl;
|
||||
// Configure receiver
|
||||
configure_receiver();
|
||||
if(generated_rinex_obs.compare("default_string") == 0)
|
||||
if (generated_rinex_obs.compare("default_string") == 0)
|
||||
{
|
||||
// Run the receiver
|
||||
ASSERT_EQ( run_receiver(), 0) << "Problem executing the software-defined signal generator";
|
||||
ASSERT_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;
|
||||
bool is_gen_rinex_obs_valid = false;
|
||||
if(internal_rinex_generation)
|
||||
if (internal_rinex_generation)
|
||||
{
|
||||
is_gen_rinex_obs_valid = check_valid_rinex_obs( "./" + generated_rinex_obs, config->property("PVT.rinex_version", 3));
|
||||
is_gen_rinex_obs_valid = check_valid_rinex_obs("./" + generated_rinex_obs, config->property("PVT.rinex_version", 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -993,28 +1001,30 @@ TEST_F(ObsSystemTest, Observables_system_test)
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::cout << "Running GNSS-SDR in Space Observables validation test..." << std::endl;
|
||||
int res = 0;
|
||||
try
|
||||
{
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
}
|
||||
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
// Run the Tests
|
||||
try
|
||||
{
|
||||
{
|
||||
res = RUN_ALL_TESTS();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG(WARNING) << "Unexpected catch";
|
||||
}
|
||||
}
|
||||
google::ShutDownCommandLineFlags();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ DEFINE_bool(plot_position_test, false, "Plots results of FFTLengthTest with gnup
|
||||
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
||||
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||
|
||||
class StaticPositionSystemTest: public ::testing::Test
|
||||
class StaticPositionSystemTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
int configure_generator();
|
||||
@@ -78,18 +78,18 @@ private:
|
||||
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
|
||||
std::string filename_raw_data = FLAGS_filename_raw_data;
|
||||
|
||||
void print_results(const std::vector<double> & east,
|
||||
const std::vector<double> & north,
|
||||
const std::vector<double> & up);
|
||||
void print_results(const std::vector<double>& east,
|
||||
const std::vector<double>& north,
|
||||
const std::vector<double>& up);
|
||||
|
||||
double compute_stdev_precision(const std::vector<double> & vec);
|
||||
double compute_stdev_accuracy(const std::vector<double> & vec, double ref);
|
||||
double compute_stdev_precision(const std::vector<double>& vec);
|
||||
double compute_stdev_accuracy(const std::vector<double>& vec, double ref);
|
||||
|
||||
void geodetic2Enu(const double latitude, const double longitude, const double altitude,
|
||||
double* east, double* north, double* up);
|
||||
double* east, double* north, double* up);
|
||||
|
||||
void geodetic2Ecef(const double latitude, const double longitude, const double altitude,
|
||||
double* x, double* y, double* z);
|
||||
double* x, double* y, double* z);
|
||||
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
std::shared_ptr<FileConfiguration> config_f;
|
||||
@@ -97,12 +97,11 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
void StaticPositionSystemTest::geodetic2Ecef(const double latitude, const double longitude, const double altitude,
|
||||
double* x, double* y, double* z)
|
||||
double* x, double* y, double* z)
|
||||
{
|
||||
const double a = 6378137.0; // WGS84
|
||||
const double b = 6356752.314245; // WGS84
|
||||
const double a = 6378137.0; // WGS84
|
||||
const double b = 6356752.314245; // WGS84
|
||||
|
||||
double aux_x, aux_y, aux_z;
|
||||
|
||||
@@ -124,7 +123,7 @@ void StaticPositionSystemTest::geodetic2Ecef(const double latitude, const double
|
||||
|
||||
|
||||
void StaticPositionSystemTest::geodetic2Enu(double latitude, double longitude, double altitude,
|
||||
double* east, double* north, double* up)
|
||||
double* east, double* north, double* up)
|
||||
{
|
||||
double x, y, z;
|
||||
const double d2r = PI / 180.0;
|
||||
@@ -166,12 +165,12 @@ void StaticPositionSystemTest::geodetic2Enu(double latitude, double longitude, d
|
||||
}
|
||||
|
||||
|
||||
double StaticPositionSystemTest::compute_stdev_precision(const std::vector<double> & vec)
|
||||
double StaticPositionSystemTest::compute_stdev_precision(const std::vector<double>& vec)
|
||||
{
|
||||
double sum__ = std::accumulate(vec.begin(), vec.end(), 0.0);
|
||||
double mean__ = sum__ / vec.size();
|
||||
double accum__ = 0.0;
|
||||
std::for_each (std::begin(vec), std::end(vec), [&](const double d) {
|
||||
std::for_each(std::begin(vec), std::end(vec), [&](const double d) {
|
||||
accum__ += (d - mean__) * (d - mean__);
|
||||
});
|
||||
double stdev__ = std::sqrt(accum__ / (vec.size() - 1));
|
||||
@@ -179,11 +178,11 @@ double StaticPositionSystemTest::compute_stdev_precision(const std::vector<doubl
|
||||
}
|
||||
|
||||
|
||||
double StaticPositionSystemTest::compute_stdev_accuracy(const std::vector<double> & vec, const double ref)
|
||||
double StaticPositionSystemTest::compute_stdev_accuracy(const std::vector<double>& vec, const double ref)
|
||||
{
|
||||
const double mean__ = ref;
|
||||
double accum__ = 0.0;
|
||||
std::for_each (std::begin(vec), std::end(vec), [&](const double d) {
|
||||
std::for_each(std::begin(vec), std::end(vec), [&](const double d) {
|
||||
accum__ += (d - mean__) * (d - mean__);
|
||||
});
|
||||
double stdev__ = std::sqrt(accum__ / (vec.size() - 1));
|
||||
@@ -197,18 +196,18 @@ int StaticPositionSystemTest::configure_generator()
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if(FLAGS_dynamic_position.empty())
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(std::min(FLAGS_duration * 10, 3000));
|
||||
if(FLAGS_duration > 300) std::cout << "WARNING: Duration has been set to its maximum value of 300 s" << std::endl;
|
||||
if (FLAGS_duration > 300) std::cout << "WARNING: Duration has been set to its maximum value of 300 s" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -218,7 +217,7 @@ int StaticPositionSystemTest::generate_signal()
|
||||
pid_t wait_result;
|
||||
int child_status;
|
||||
|
||||
char *const parmList[] = { &generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL };
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
@@ -238,7 +237,7 @@ int StaticPositionSystemTest::generate_signal()
|
||||
|
||||
int StaticPositionSystemTest::configure_receiver()
|
||||
{
|
||||
if(FLAGS_config_file_ptest.empty())
|
||||
if (FLAGS_config_file_ptest.empty())
|
||||
{
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
const int sampling_rate_internal = baseband_sampling_freq;
|
||||
@@ -406,7 +405,7 @@ int StaticPositionSystemTest::configure_receiver()
|
||||
int StaticPositionSystemTest::run_receiver()
|
||||
{
|
||||
std::shared_ptr<ControlThread> control_thread;
|
||||
if(FLAGS_config_file_ptest.empty())
|
||||
if (FLAGS_config_file_ptest.empty())
|
||||
{
|
||||
control_thread = std::make_shared<ControlThread>(config);
|
||||
}
|
||||
@@ -417,21 +416,21 @@ int StaticPositionSystemTest::run_receiver()
|
||||
|
||||
// start receiver
|
||||
try
|
||||
{
|
||||
{
|
||||
control_thread->run();
|
||||
}
|
||||
catch(const boost::exception & e)
|
||||
{
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
|
||||
// Get the name of the KML file generated by the receiver
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
FILE *fp;
|
||||
FILE* fp;
|
||||
std::string argum2 = std::string("/bin/ls *kml | tail -1");
|
||||
char buffer[1035];
|
||||
fp = popen(&argum2[0], "r");
|
||||
@@ -464,7 +463,7 @@ void StaticPositionSystemTest::check_results()
|
||||
// Skip header
|
||||
std::getline(myfile, line);
|
||||
bool is_header = true;
|
||||
while(is_header)
|
||||
while (is_header)
|
||||
{
|
||||
std::getline(myfile, line);
|
||||
std::size_t found = line.find("<coordinates>");
|
||||
@@ -473,11 +472,12 @@ void StaticPositionSystemTest::check_results()
|
||||
bool is_data = true;
|
||||
|
||||
//read data
|
||||
while(is_data)
|
||||
while (is_data)
|
||||
{
|
||||
std::getline(myfile, line);
|
||||
std::size_t found = line.find("</coordinates>");
|
||||
if (found != std::string::npos) is_data = false;
|
||||
if (found != std::string::npos)
|
||||
is_data = false;
|
||||
else
|
||||
{
|
||||
std::string str2;
|
||||
@@ -490,9 +490,9 @@ void StaticPositionSystemTest::check_results()
|
||||
{
|
||||
std::getline(iss, str2, ',');
|
||||
value = std::stod(str2);
|
||||
if(i == 0) lat = value;
|
||||
if(i == 1) longitude = value;
|
||||
if(i == 2) h = value;
|
||||
if (i == 0) lat = value;
|
||||
if (i == 1) longitude = value;
|
||||
if (i == 2) h = value;
|
||||
}
|
||||
|
||||
double north, east, up;
|
||||
@@ -523,7 +523,7 @@ void StaticPositionSystemTest::check_results()
|
||||
std::stringstream stm;
|
||||
std::ofstream position_test_file;
|
||||
|
||||
if(FLAGS_config_file_ptest.empty())
|
||||
if (FLAGS_config_file_ptest.empty())
|
||||
{
|
||||
stm << "---- ACCURACY ----" << std::endl;
|
||||
stm << "2DRMS = " << 2 * sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]" << std::endl;
|
||||
@@ -548,31 +548,31 @@ void StaticPositionSystemTest::check_results()
|
||||
stm << "SEP = " << 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision) << " [m]" << std::endl;
|
||||
|
||||
std::cout << stm.rdbuf();
|
||||
std::string output_filename = "position_test_output_" + StaticPositionSystemTest::generated_kml_file.erase(StaticPositionSystemTest::generated_kml_file.length() - 3,3) + "txt";
|
||||
std::string output_filename = "position_test_output_" + StaticPositionSystemTest::generated_kml_file.erase(StaticPositionSystemTest::generated_kml_file.length() - 3, 3) + "txt";
|
||||
position_test_file.open(output_filename.c_str());
|
||||
if(position_test_file.is_open())
|
||||
if (position_test_file.is_open())
|
||||
{
|
||||
position_test_file << stm.str();
|
||||
position_test_file.close();
|
||||
}
|
||||
|
||||
// Sanity Check
|
||||
double precision_SEP = 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision);
|
||||
double precision_SEP = 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision);
|
||||
ASSERT_LT(precision_SEP, 20.0);
|
||||
|
||||
if(FLAGS_plot_position_test == true)
|
||||
if (FLAGS_plot_position_test == true)
|
||||
{
|
||||
print_results(pos_e, pos_n, pos_u);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void StaticPositionSystemTest::print_results(const std::vector<double> & east,
|
||||
const std::vector<double> & north,
|
||||
const std::vector<double> & up)
|
||||
void StaticPositionSystemTest::print_results(const std::vector<double>& east,
|
||||
const std::vector<double>& north,
|
||||
const std::vector<double>& up)
|
||||
{
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_position_test has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -604,7 +604,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double> & east,
|
||||
double two_drms = 2 * sqrt(sigma_E_2_precision + sigma_N_2_precision);
|
||||
double ninty_sas = 0.833 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision);
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -627,7 +627,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double> & east,
|
||||
|
||||
g1.savetops("Position_test_2D");
|
||||
g1.savetopdf("Position_test_2D", 18);
|
||||
g1.showonscreen(); // window output
|
||||
g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("points");
|
||||
g2.set_title("3D precision");
|
||||
@@ -642,31 +642,30 @@ void StaticPositionSystemTest::print_results(const std::vector<double> & east,
|
||||
g2.cmd("set ticslevel 0");
|
||||
|
||||
g2.cmd("set style fill transparent solid 0.30 border\n set parametric\n set urange [0:2.0*pi]\n set vrange [-pi/2:pi/2]\n r = " +
|
||||
std::to_string(ninty_sas) +
|
||||
"\n fx(v,u) = r*cos(v)*cos(u)\n fy(v,u) = r*cos(v)*sin(u)\n fz(v) = r*sin(v) \n splot fx(v,u),fy(v,u),fz(v) title \"90\%-SAS\" lt rgb \"gray\"\n");
|
||||
std::to_string(ninty_sas) +
|
||||
"\n fx(v,u) = r*cos(v)*cos(u)\n fy(v,u) = r*cos(v)*sin(u)\n fz(v) = r*sin(v) \n splot fx(v,u),fy(v,u),fz(v) title \"90\%-SAS\" lt rgb \"gray\"\n");
|
||||
g2.plot_xyz(east, north, up, "3D Position Fixes");
|
||||
|
||||
g2.savetops("Position_test_3D");
|
||||
g2.savetopdf("Position_test_3D");
|
||||
g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TEST_F(StaticPositionSystemTest, Position_system_test)
|
||||
{
|
||||
if(FLAGS_config_file_ptest.empty())
|
||||
if (FLAGS_config_file_ptest.empty())
|
||||
{
|
||||
// Configure the signal generator
|
||||
configure_generator();
|
||||
|
||||
// Generate signal raw signal samples and observations RINEX file
|
||||
if(!FLAGS_disable_generator)
|
||||
if (!FLAGS_disable_generator)
|
||||
{
|
||||
generate_signal();
|
||||
}
|
||||
@@ -676,35 +675,37 @@ TEST_F(StaticPositionSystemTest, Position_system_test)
|
||||
configure_receiver();
|
||||
|
||||
// Run the receiver
|
||||
EXPECT_EQ( run_receiver(), 0) << "Problem executing the software-defined signal generator";
|
||||
EXPECT_EQ(run_receiver(), 0) << "Problem executing the software-defined signal generator";
|
||||
|
||||
// Check results
|
||||
check_results();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::cout << "Running Position precision test..." << std::endl;
|
||||
int res = 0;
|
||||
try
|
||||
{
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
}
|
||||
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
|
||||
// Run the Tests
|
||||
try
|
||||
{
|
||||
{
|
||||
res = RUN_ALL_TESTS();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG(WARNING) << "Unexpected catch";
|
||||
}
|
||||
}
|
||||
google::ShutDownCommandLineFlags();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -68,18 +68,19 @@ concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||
std::vector<double> TTFF_v;
|
||||
const int decimation_factor = 1;
|
||||
|
||||
typedef struct {
|
||||
long mtype; // required by SysV message
|
||||
typedef struct
|
||||
{
|
||||
long mtype; // required by SysV message
|
||||
double ttff;
|
||||
} ttff_msgbuf;
|
||||
|
||||
|
||||
class TfttGpsL1CATest: public ::testing::Test
|
||||
class TfttGpsL1CATest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
void config_1();
|
||||
void config_2();
|
||||
void print_TTFF_report(const std::vector<double> & ttff_v, std::shared_ptr<ConfigurationInterface> config_);
|
||||
void print_TTFF_report(const std::vector<double> &ttff_v, std::shared_ptr<ConfigurationInterface> config_);
|
||||
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
std::shared_ptr<FileConfiguration> config2;
|
||||
@@ -236,7 +237,7 @@ void TfttGpsL1CATest::config_1()
|
||||
|
||||
void TfttGpsL1CATest::config_2()
|
||||
{
|
||||
if(FLAGS_config_file_ttff.empty())
|
||||
if (FLAGS_config_file_ttff.empty())
|
||||
{
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string filename = path + "../../conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf";
|
||||
@@ -267,25 +268,29 @@ void receive_msg()
|
||||
key_t key_stop = 1102;
|
||||
bool leave = false;
|
||||
|
||||
while(!leave)
|
||||
while (!leave)
|
||||
{
|
||||
// wait for the queue to be created
|
||||
while((msqid = msgget(key, 0644)) == -1){}
|
||||
while ((msqid = msgget(key, 0644)) == -1)
|
||||
{
|
||||
}
|
||||
|
||||
if (msgrcv(msqid, &msg, msgrcv_size, 1, 0) != -1)
|
||||
{
|
||||
ttff_msg = msg.ttff;
|
||||
if( (ttff_msg != 0) && (ttff_msg != -1))
|
||||
if ((ttff_msg != 0) && (ttff_msg != -1))
|
||||
{
|
||||
TTFF_v.push_back(ttff_msg);
|
||||
LOG(INFO) << "Valid Time-To-First-Fix: " << ttff_msg << "[s]";
|
||||
// Stop the receiver
|
||||
while(((msqid_stop = msgget(key_stop, 0644))) == -1){}
|
||||
while (((msqid_stop = msgget(key_stop, 0644))) == -1)
|
||||
{
|
||||
}
|
||||
double msgsend_size = sizeof(msg_stop.ttff);
|
||||
msgsnd(msqid_stop, &msg_stop, msgsend_size, IPC_NOWAIT);
|
||||
}
|
||||
|
||||
if( std::abs(ttff_msg - (-1.0) ) < 10 * std::numeric_limits<double>::epsilon() )
|
||||
if (std::abs(ttff_msg - (-1.0)) < 10 * std::numeric_limits<double>::epsilon())
|
||||
{
|
||||
leave = true;
|
||||
}
|
||||
@@ -295,7 +300,7 @@ void receive_msg()
|
||||
}
|
||||
|
||||
|
||||
void TfttGpsL1CATest::print_TTFF_report(const std::vector<double> & ttff_v, std::shared_ptr<ConfigurationInterface> config_)
|
||||
void TfttGpsL1CATest::print_TTFF_report(const std::vector<double> &ttff_v, std::shared_ptr<ConfigurationInterface> config_)
|
||||
{
|
||||
std::ofstream ttff_report_file;
|
||||
std::string filename = "ttff_report";
|
||||
@@ -308,38 +313,38 @@ void TfttGpsL1CATest::print_TTFF_report(const std::vector<double> & ttff_v, std:
|
||||
const int year = timeinfo.tm_year - 100;
|
||||
strm0 << year;
|
||||
const int month = timeinfo.tm_mon + 1;
|
||||
if(month < 10)
|
||||
if (month < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << month;
|
||||
const int day = timeinfo.tm_mday;
|
||||
if(day < 10)
|
||||
if (day < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << day << "_";
|
||||
const int hour = timeinfo.tm_hour;
|
||||
if(hour < 10)
|
||||
{
|
||||
if (hour < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << hour;
|
||||
const int min = timeinfo.tm_min;
|
||||
|
||||
if(min < 10)
|
||||
if (min < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << min;
|
||||
const int sec = timeinfo.tm_sec;
|
||||
if(sec < 10)
|
||||
if (sec < 10)
|
||||
{
|
||||
strm0 << "0";
|
||||
}
|
||||
strm0 << sec;
|
||||
|
||||
filename_ = filename + "_" + strm0.str() + ".txt";
|
||||
filename_ = filename + "_" + strm0.str() + ".txt";
|
||||
|
||||
ttff_report_file.open(filename_.c_str());
|
||||
|
||||
@@ -363,7 +368,7 @@ void TfttGpsL1CATest::print_TTFF_report(const std::vector<double> & ttff_v, std:
|
||||
|
||||
stm << "---------------------------" << std::endl;
|
||||
stm << " Time-To-First-Fix Report" << std::endl;
|
||||
stm << "---------------------------" << std::endl;
|
||||
stm << "---------------------------" << std::endl;
|
||||
stm << "Initial receiver status: ";
|
||||
if (read_ephemeris)
|
||||
{
|
||||
@@ -383,7 +388,7 @@ void TfttGpsL1CATest::print_TTFF_report(const std::vector<double> & ttff_v, std:
|
||||
stm << "Disabled." << std::endl;
|
||||
}
|
||||
stm << "Valid measurements (" << ttff.size() << "/" << FLAGS_num_measurements << "): ";
|
||||
for(double ttff_ : ttff) stm << ttff_ << " ";
|
||||
for (double ttff_ : ttff) stm << ttff_ << " ";
|
||||
stm << std::endl;
|
||||
stm << "TTFF mean: " << mean << " [s]" << std::endl;
|
||||
if (ttff.size() > 0)
|
||||
@@ -393,9 +398,10 @@ void TfttGpsL1CATest::print_TTFF_report(const std::vector<double> & ttff_v, std:
|
||||
}
|
||||
stm << "TTFF stdev: " << stdev << " [s]" << std::endl;
|
||||
stm << "Operating System: " << std::string(HOST_SYSTEM) << std::endl;
|
||||
stm << "Navigation mode: " << "3D" << std::endl;
|
||||
stm << "Navigation mode: "
|
||||
<< "3D" << std::endl;
|
||||
|
||||
if(source.compare("UHD_Signal_Source"))
|
||||
if (source.compare("UHD_Signal_Source"))
|
||||
{
|
||||
stm << "Source: File" << std::endl;
|
||||
}
|
||||
@@ -429,11 +435,11 @@ TEST_F(TfttGpsL1CATest, ColdStart)
|
||||
config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false");
|
||||
config2->set_property("PVT.flag_rtcm_server", "false");
|
||||
|
||||
for(int n = 0; n < FLAGS_num_measurements; n++)
|
||||
for (int n = 0; n < FLAGS_num_measurements; n++)
|
||||
{
|
||||
// Create a new ControlThread object with a smart pointer
|
||||
std::shared_ptr<ControlThread> control_thread;
|
||||
if(FLAGS_config_file_ttff.empty())
|
||||
if (FLAGS_config_file_ttff.empty())
|
||||
{
|
||||
control_thread = std::make_shared<ControlThread>(config);
|
||||
}
|
||||
@@ -448,17 +454,17 @@ TEST_F(TfttGpsL1CATest, ColdStart)
|
||||
start = std::chrono::system_clock::now();
|
||||
// start receiver
|
||||
try
|
||||
{
|
||||
{
|
||||
control_thread->run();
|
||||
}
|
||||
catch(const boost::exception & e)
|
||||
{
|
||||
}
|
||||
catch (const boost::exception &e)
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
|
||||
// stop clock
|
||||
end = std::chrono::system_clock::now();
|
||||
@@ -470,7 +476,7 @@ TEST_F(TfttGpsL1CATest, ColdStart)
|
||||
|
||||
num_measurements = num_measurements + 1;
|
||||
std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds." << std::endl;
|
||||
if(n < FLAGS_num_measurements - 1)
|
||||
if (n < FLAGS_num_measurements - 1)
|
||||
{
|
||||
std::random_device r;
|
||||
std::default_random_engine e1(r());
|
||||
@@ -478,13 +484,14 @@ TEST_F(TfttGpsL1CATest, ColdStart)
|
||||
float random_variable_0_1 = uniform_dist(e1);
|
||||
int random_delay_s = static_cast<int>(random_variable_0_1 * 25.0);
|
||||
std::cout << "Waiting a random amount of time (from 5 to 30 s) to start a new measurement... " << std::endl;
|
||||
std::cout << "This time will wait " << random_delay_s + 5 << " s." << std::endl << 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
|
||||
if(FLAGS_config_file_ttff.empty())
|
||||
if (FLAGS_config_file_ttff.empty())
|
||||
{
|
||||
print_TTFF_report(TTFF_v, config);
|
||||
}
|
||||
@@ -492,7 +499,7 @@ TEST_F(TfttGpsL1CATest, ColdStart)
|
||||
{
|
||||
print_TTFF_report(TTFF_v, config2);
|
||||
}
|
||||
std::this_thread::sleep_until(std::chrono::system_clock::now() + std::chrono::seconds(5)); //let the USRP some time to rest before the next test
|
||||
std::this_thread::sleep_until(std::chrono::system_clock::now() + std::chrono::seconds(5)); //let the USRP some time to rest before the next test
|
||||
}
|
||||
|
||||
|
||||
@@ -512,11 +519,11 @@ TEST_F(TfttGpsL1CATest, HotStart)
|
||||
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++)
|
||||
for (int n = 0; n < FLAGS_num_measurements; n++)
|
||||
{
|
||||
// Create a new ControlThread object with a smart pointer
|
||||
std::shared_ptr<ControlThread> control_thread;
|
||||
if(FLAGS_config_file_ttff.empty())
|
||||
if (FLAGS_config_file_ttff.empty())
|
||||
{
|
||||
control_thread = std::make_shared<ControlThread>(config);
|
||||
}
|
||||
@@ -531,17 +538,17 @@ TEST_F(TfttGpsL1CATest, HotStart)
|
||||
|
||||
// start receiver
|
||||
try
|
||||
{
|
||||
{
|
||||
control_thread->run();
|
||||
}
|
||||
catch(const boost::exception & e)
|
||||
{
|
||||
}
|
||||
catch (const boost::exception &e)
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
|
||||
// stop clock
|
||||
end = std::chrono::system_clock::now();
|
||||
@@ -553,7 +560,7 @@ TEST_F(TfttGpsL1CATest, HotStart)
|
||||
|
||||
num_measurements = num_measurements + 1;
|
||||
std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds." << std::endl;
|
||||
if(n < FLAGS_num_measurements - 1)
|
||||
if (n < FLAGS_num_measurements - 1)
|
||||
{
|
||||
std::random_device r;
|
||||
std::default_random_engine e1(r());
|
||||
@@ -561,13 +568,14 @@ TEST_F(TfttGpsL1CATest, HotStart)
|
||||
float random_variable_0_1 = uniform_dist(e1);
|
||||
int random_delay_s = static_cast<int>(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::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
|
||||
if(FLAGS_config_file_ttff.empty())
|
||||
if (FLAGS_config_file_ttff.empty())
|
||||
{
|
||||
print_TTFF_report(TTFF_v, config);
|
||||
}
|
||||
@@ -584,10 +592,12 @@ int main(int argc, char **argv)
|
||||
int res = 0;
|
||||
TTFF_v.clear();
|
||||
try
|
||||
{
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
}
|
||||
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
@@ -597,24 +607,24 @@ int main(int argc, char **argv)
|
||||
|
||||
// Run the Tests
|
||||
try
|
||||
{
|
||||
{
|
||||
res = RUN_ALL_TESTS();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG(WARNING) << "Unexpected catch";
|
||||
}
|
||||
}
|
||||
|
||||
// Terminate the queue thread
|
||||
key_t sysv_msg_key;
|
||||
int sysv_msqid;
|
||||
sysv_msg_key = 1101;
|
||||
int msgflg = IPC_CREAT | 0666;
|
||||
if ((sysv_msqid = msgget(sysv_msg_key, msgflg )) == -1)
|
||||
{
|
||||
std::cout << "GNSS-SDR can not create message queues!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
if ((sysv_msqid = msgget(sysv_msg_key, msgflg)) == -1)
|
||||
{
|
||||
std::cout << "GNSS-SDR can not create message queues!" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
ttff_msgbuf msg;
|
||||
msg.mtype = 1;
|
||||
msg.ttff = -1;
|
||||
|
||||
+10
-8
@@ -164,20 +164,22 @@ int main(int argc, char **argv)
|
||||
std::cout << "Running GNSS-SDR Tests..." << std::endl;
|
||||
int res = 0;
|
||||
try
|
||||
{
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
}
|
||||
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
try
|
||||
{
|
||||
{
|
||||
res = RUN_ALL_TESTS();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG(WARNING) << "Unexpected catch";
|
||||
}
|
||||
}
|
||||
google::ShutDownCommandLineFlags();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "gnss_signal_processing.h"
|
||||
|
||||
|
||||
|
||||
TEST(CodeGenerationTest, CodeGenGPSL1Test)
|
||||
{
|
||||
std::complex<float>* _dest = new std::complex<float>[1023];
|
||||
@@ -47,9 +46,9 @@ TEST(CodeGenerationTest, CodeGenGPSL1Test)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for(int i = 0; i < iterations; i++)
|
||||
for (int i = 0; i < iterations; i++)
|
||||
{
|
||||
gps_l1_ca_code_gen_complex( _dest, _prn, _chip_shift);
|
||||
gps_l1_ca_code_gen_complex(_dest, _prn, _chip_shift);
|
||||
}
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
@@ -66,7 +65,7 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
|
||||
signed int _prn = 1;
|
||||
unsigned int _chip_shift = 4;
|
||||
double _fs = 8000000.0;
|
||||
const signed int _codeFreqBasis = 1023000; //Hz
|
||||
const signed int _codeFreqBasis = 1023000; //Hz
|
||||
const signed int _codeLength = 1023;
|
||||
int _samplesPerCode = round(_fs / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
std::complex<float>* _dest = new std::complex<float>[_samplesPerCode];
|
||||
@@ -76,9 +75,9 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for(int i = 0; i < iterations; i++)
|
||||
for (int i = 0; i < iterations; i++)
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled( _dest, _prn, _fs, _chip_shift);
|
||||
gps_l1_ca_code_gen_complex_sampled(_dest, _prn, _fs, _chip_shift);
|
||||
}
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
@@ -94,7 +93,7 @@ TEST(CodeGenerationTest, ComplexConjugateTest)
|
||||
{
|
||||
double _fs = 8000000.0;
|
||||
double _f = 4000.0;
|
||||
const signed int _codeFreqBasis = 1023000; //Hz
|
||||
const signed int _codeFreqBasis = 1023000; //Hz
|
||||
const signed int _codeLength = 1023;
|
||||
int _samplesPerCode = round(_fs / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
std::complex<float>* _dest = new std::complex<float>[_samplesPerCode];
|
||||
@@ -104,9 +103,9 @@ TEST(CodeGenerationTest, ComplexConjugateTest)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for(int i = 0; i < iterations; i++)
|
||||
for (int i = 0; i < iterations; i++)
|
||||
{
|
||||
complex_exp_gen_conj( _dest, _f, _fs, _samplesPerCode);
|
||||
complex_exp_gen_conj(_dest, _f, _fs, _samplesPerCode);
|
||||
}
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
|
||||
@@ -50,26 +50,26 @@ TEST(ComplexCarrierTest, StandardComplexImplementation)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for(int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
{
|
||||
output[i] = std::complex<float>(cos(phase), sin(phase));
|
||||
phase += phase_step;
|
||||
}
|
||||
for (int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
{
|
||||
output[i] = std::complex<float>(cos(phase), sin(phase));
|
||||
phase += phase_step;
|
||||
}
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "A " << FLAGS_size_carrier_test
|
||||
<< "-length complex carrier in standard C++ (dynamic allocation) generated in " << elapsed_seconds.count() * 1e6
|
||||
<< "-length complex carrier in standard C++ (dynamic allocation) generated in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
|
||||
std::complex<float> expected(1,0);
|
||||
std::complex<float> expected(1, 0);
|
||||
std::vector<std::complex<float>> mag(FLAGS_size_carrier_test);
|
||||
for(int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
{
|
||||
mag[i] = output[i] * std::conj(output[i]);
|
||||
}
|
||||
delete[] output;
|
||||
for(int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
{
|
||||
ASSERT_FLOAT_EQ(std::norm(expected), std::norm(mag[i]));
|
||||
}
|
||||
@@ -101,9 +101,9 @@ TEST(ComplexCarrierTest, C11ComplexImplementation)
|
||||
<< "-length complex carrier in standard C++ (declaration) generated in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
std::complex<float> expected(1,0);
|
||||
std::complex<float> expected(1, 0);
|
||||
std::vector<std::complex<float>> mag(FLAGS_size_carrier_test);
|
||||
for(int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
{
|
||||
mag[i] = output[i] * std::conj(output[i]);
|
||||
ASSERT_FLOAT_EQ(std::norm(expected), std::norm(mag[i]));
|
||||
@@ -111,8 +111,6 @@ TEST(ComplexCarrierTest, C11ComplexImplementation)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TEST(ComplexCarrierTest, OwnComplexImplementation)
|
||||
{
|
||||
std::complex<float>* output = new std::complex<float>[FLAGS_size_carrier_test];
|
||||
@@ -129,14 +127,14 @@ TEST(ComplexCarrierTest, OwnComplexImplementation)
|
||||
<< "-length complex carrier using fixed point generated in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
|
||||
std::complex<float> expected(1,0);
|
||||
std::complex<float> expected(1, 0);
|
||||
std::vector<std::complex<float>> mag(FLAGS_size_carrier_test);
|
||||
for(int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
{
|
||||
mag[i] = output[i] * std::conj(output[i]);
|
||||
}
|
||||
delete[] output;
|
||||
for(int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_carrier_test; i++)
|
||||
{
|
||||
ASSERT_NEAR(std::norm(expected), std::norm(mag[i]), 0.0001);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
DEFINE_int32(size_conjugate_test, 100000, "Size of the arrays used for conjugate testing");
|
||||
|
||||
|
||||
|
||||
TEST(ConjugateTest, StandardCComplexImplementation)
|
||||
{
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_size_conjugate_test];
|
||||
@@ -49,7 +48,7 @@ TEST(ConjugateTest, StandardCComplexImplementation)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for(int i = 0; i < FLAGS_size_conjugate_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_conjugate_test; i++)
|
||||
{
|
||||
output[i] = std::conj(input[i]);
|
||||
}
|
||||
@@ -63,7 +62,6 @@ TEST(ConjugateTest, StandardCComplexImplementation)
|
||||
delete[] input;
|
||||
delete[] output;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +72,7 @@ TEST(ConjugateTest, C11ComplexImplementation)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
int pos = 0;
|
||||
for (const auto &item : input)
|
||||
for (const auto& item : input)
|
||||
{
|
||||
output[pos++] = std::conj(item);
|
||||
}
|
||||
@@ -85,9 +83,9 @@ TEST(ConjugateTest, C11ComplexImplementation)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
|
||||
std::complex<float> expected(0,0);
|
||||
std::complex<float> result(0,0);
|
||||
for (const auto &item : output)
|
||||
std::complex<float> expected(0, 0);
|
||||
std::complex<float> result(0, 0);
|
||||
for (const auto& item : output)
|
||||
{
|
||||
result += item;
|
||||
}
|
||||
@@ -127,7 +125,7 @@ TEST(ConjugateTest, VolkComplexImplementation)
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "Conjugate of a "<< FLAGS_size_conjugate_test
|
||||
std::cout << "Conjugate of a " << FLAGS_size_conjugate_test
|
||||
<< "-length complex float vector using VOLK finished in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
|
||||
@@ -47,9 +47,9 @@ DEFINE_bool(plot_fft_length_test, false, "Plots results of FFTLengthTest with gn
|
||||
|
||||
TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
{
|
||||
unsigned int fft_sizes [] = { 512, 1000, 1024, 1100, 1297, 1400, 1500, 1960, 2000, 2048, 2221, 2500, 3000, 3500, 4000,
|
||||
4096, 4200, 4500, 4725, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8192, 8500, 9000, 9500, 10000, 10368, 11000,
|
||||
12000, 15000, 16000, 16384, 27000, 32768, 50000, 65536 };
|
||||
unsigned int fft_sizes[] = {512, 1000, 1024, 1100, 1297, 1400, 1500, 1960, 2000, 2048, 2221, 2500, 3000, 3500, 4000,
|
||||
4096, 4200, 4500, 4725, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8192, 8500, 9000, 9500, 10000, 10368, 11000,
|
||||
12000, 15000, 16000, 16384, 27000, 32768, 50000, 65536};
|
||||
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
|
||||
@@ -57,12 +57,12 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
std::default_random_engine e1(r());
|
||||
std::default_random_engine e2(r());
|
||||
std::uniform_real_distribution<float> uniform_dist(-1, 1);
|
||||
auto func = [] (float a, float b) { return gr_complex(a, b); }; // Helper lambda function that returns a gr_complex
|
||||
auto func = [](float a, float b) { return gr_complex(a, b); }; // Helper lambda function that returns a gr_complex
|
||||
auto random_number1 = std::bind(uniform_dist, e1);
|
||||
auto random_number2 = std::bind(uniform_dist, e2);
|
||||
auto gen = std::bind(func, random_number1, random_number2); // Function that returns a random gr_complex
|
||||
auto gen = std::bind(func, random_number1, random_number2); // Function that returns a random gr_complex
|
||||
|
||||
std::vector<unsigned int> fft_sizes_v(fft_sizes, fft_sizes + sizeof(fft_sizes) / sizeof(unsigned int) );
|
||||
std::vector<unsigned int> fft_sizes_v(fft_sizes, fft_sizes + sizeof(fft_sizes) / sizeof(unsigned int));
|
||||
std::sort(fft_sizes_v.begin(), fft_sizes_v.end());
|
||||
std::vector<unsigned int>::const_iterator it;
|
||||
unsigned int d_fft_size;
|
||||
@@ -71,38 +71,36 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
std::vector<double> execution_times_powers_of_two;
|
||||
|
||||
EXPECT_NO_THROW(
|
||||
for(it = fft_sizes_v.cbegin(); it != fft_sizes_v.cend(); ++it)
|
||||
for (it = fft_sizes_v.cbegin(); it != fft_sizes_v.cend(); ++it) {
|
||||
gr::fft::fft_complex* d_fft;
|
||||
d_fft_size = *it;
|
||||
d_fft = new gr::fft::fft_complex(d_fft_size, true);
|
||||
|
||||
std::generate_n(d_fft->get_inbuf(), d_fft_size, gen);
|
||||
|
||||
start = std::chrono::system_clock::now();
|
||||
for (int k = 0; k < FLAGS_fft_iterations_test; k++)
|
||||
{
|
||||
gr::fft::fft_complex* d_fft;
|
||||
d_fft_size = *it;
|
||||
d_fft = new gr::fft::fft_complex(d_fft_size, true);
|
||||
|
||||
std::generate_n( d_fft->get_inbuf(), d_fft_size, gen );
|
||||
|
||||
start = std::chrono::system_clock::now();
|
||||
for(int k = 0; k < FLAGS_fft_iterations_test; k++)
|
||||
{
|
||||
d_fft->execute();
|
||||
}
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
double exec_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_iterations_test);
|
||||
execution_times.push_back(exec_time * 1e3);
|
||||
std::cout << "FFT execution time for length=" << d_fft_size << " : " << exec_time << " [s]" << std::endl;
|
||||
delete d_fft;
|
||||
|
||||
if( (d_fft_size & (d_fft_size - 1)) == 0 ) // if it is a power of two
|
||||
{
|
||||
powers_of_two.push_back(d_fft_size);
|
||||
execution_times_powers_of_two.push_back(exec_time / 1e-3);
|
||||
}
|
||||
d_fft->execute();
|
||||
}
|
||||
);
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
double exec_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_iterations_test);
|
||||
execution_times.push_back(exec_time * 1e3);
|
||||
std::cout << "FFT execution time for length=" << d_fft_size << " : " << exec_time << " [s]" << std::endl;
|
||||
delete d_fft;
|
||||
|
||||
if(FLAGS_plot_fft_length_test == true)
|
||||
if ((d_fft_size & (d_fft_size - 1)) == 0) // if it is a power of two
|
||||
{
|
||||
powers_of_two.push_back(d_fft_size);
|
||||
execution_times_powers_of_two.push_back(exec_time / 1e-3);
|
||||
}
|
||||
});
|
||||
|
||||
if (FLAGS_plot_fft_length_test == true)
|
||||
{
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_fft_length_test has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -111,7 +109,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -126,7 +124,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||
g1.savetops("FFT_execution_times_extended");
|
||||
g1.savetopdf("FFT_execution_times_extended", 18);
|
||||
g1.showonscreen(); // window output
|
||||
g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("linespoints");
|
||||
g2.set_title("FFT execution times for different lengths (up to 2^{14}=16384)");
|
||||
@@ -138,12 +136,12 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||
g2.savetops("FFT_execution_times");
|
||||
g2.savetopdf("FFT_execution_times", 18);
|
||||
g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,39 +43,37 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds;
|
||||
|
||||
unsigned int fft_sizes [19] = { 16, 25, 32, 45, 64, 95, 128, 195, 256, 325, 512, 785, 1024, 1503, 2048, 3127, 4096, 6349, 8192 };
|
||||
unsigned int fft_sizes[19] = {16, 25, 32, 45, 64, 95, 128, 195, 256, 325, 512, 785, 1024, 1503, 2048, 3127, 4096, 6349, 8192};
|
||||
double d_execution_time;
|
||||
EXPECT_NO_THROW(
|
||||
for(int i = 0; i < 19; i++)
|
||||
{
|
||||
d_fft_size = fft_sizes[i];
|
||||
gr::fft::fft_complex* d_gr_fft;
|
||||
d_gr_fft = new gr::fft::fft_complex(d_fft_size, true);
|
||||
arma::arma_rng::set_seed_random();
|
||||
arma::cx_fvec d_arma_fft = arma::cx_fvec(d_fft_size).randn() + gr_complex(0.0, 1.0) * arma::cx_fvec(d_fft_size).randn();
|
||||
arma::cx_fvec d_arma_fft_result(d_fft_size);
|
||||
memcpy(d_gr_fft->get_inbuf(), d_arma_fft.memptr(), sizeof(gr_complex) * d_fft_size);
|
||||
|
||||
start = std::chrono::system_clock::now();
|
||||
for(int k = 0; k < FLAGS_fft_speed_iterations_test; k++)
|
||||
{
|
||||
d_gr_fft->execute();
|
||||
}
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
d_execution_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_speed_iterations_test);
|
||||
std::cout << "GNU Radio FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl;
|
||||
delete d_gr_fft;
|
||||
for (int i = 0; i < 19; i++) {
|
||||
d_fft_size = fft_sizes[i];
|
||||
gr::fft::fft_complex* d_gr_fft;
|
||||
d_gr_fft = new gr::fft::fft_complex(d_fft_size, true);
|
||||
arma::arma_rng::set_seed_random();
|
||||
arma::cx_fvec d_arma_fft = arma::cx_fvec(d_fft_size).randn() + gr_complex(0.0, 1.0) * arma::cx_fvec(d_fft_size).randn();
|
||||
arma::cx_fvec d_arma_fft_result(d_fft_size);
|
||||
memcpy(d_gr_fft->get_inbuf(), d_arma_fft.memptr(), sizeof(gr_complex) * d_fft_size);
|
||||
|
||||
start = std::chrono::system_clock::now();
|
||||
for(int k = 0; k < FLAGS_fft_speed_iterations_test; k++)
|
||||
{
|
||||
d_arma_fft_result = arma::fft(d_arma_fft);
|
||||
}
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
d_execution_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_speed_iterations_test);
|
||||
std::cout << "Armadillo FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++)
|
||||
{
|
||||
d_gr_fft->execute();
|
||||
}
|
||||
);
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
d_execution_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_speed_iterations_test);
|
||||
std::cout << "GNU Radio FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl;
|
||||
delete d_gr_fft;
|
||||
|
||||
start = std::chrono::system_clock::now();
|
||||
for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++)
|
||||
{
|
||||
d_arma_fft_result = arma::fft(d_arma_fft);
|
||||
}
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
d_execution_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_speed_iterations_test);
|
||||
std::cout << "Armadillo FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ TEST(MagnitudeSquaredTest, StandardCComplexImplementation)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for(number = 0; number < static_cast<unsigned int>(FLAGS_size_magnitude_test); number++)
|
||||
for (number = 0; number < static_cast<unsigned int>(FLAGS_size_magnitude_test); number++)
|
||||
{
|
||||
output[number] = (input[number].real() * input[number].real()) + (input[number].imag() * input[number].imag());
|
||||
}
|
||||
@@ -72,7 +72,7 @@ TEST(MagnitudeSquaredTest, C11ComplexImplementation)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for (const auto &item : input)
|
||||
for (const auto& item : input)
|
||||
{
|
||||
output[pos++] = std::norm(item);
|
||||
}
|
||||
@@ -84,9 +84,9 @@ TEST(MagnitudeSquaredTest, C11ComplexImplementation)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
|
||||
std::complex<float> expected(0,0);
|
||||
std::complex<float> result(0,0);
|
||||
for (const auto &item : output)
|
||||
std::complex<float> expected(0, 0);
|
||||
std::complex<float> result(0, 0);
|
||||
for (const auto& item : output)
|
||||
{
|
||||
result += item;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ TEST(MagnitudeSquaredTest, ArmadilloComplexImplementation)
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test
|
||||
std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test
|
||||
<< "-length vector using Armadillo computed in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
@@ -124,7 +124,7 @@ TEST(MagnitudeSquaredTest, VolkComplexImplementation)
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test
|
||||
std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test
|
||||
<< "-length vector using VOLK computed in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
volk_gnsssdr_free(input);
|
||||
@@ -133,4 +133,3 @@ TEST(MagnitudeSquaredTest, VolkComplexImplementation)
|
||||
}
|
||||
|
||||
// volk_32f_accumulator_s32f(&d_input_power, d_magnitude, d_fft_size);
|
||||
|
||||
|
||||
@@ -42,14 +42,14 @@ TEST(MatioTest, WriteAndReadDoubles)
|
||||
matvar_t *matvar;
|
||||
std::string filename = "./test.mat";
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matfp) == NULL) << "Error creating .mat file";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matfp) == NULL) << "Error creating .mat file";
|
||||
|
||||
double x[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
double x[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
size_t dims[2] = {10, 1};
|
||||
matvar = Mat_VarCreate("x", MAT_C_DOUBLE, MAT_T_DOUBLE, 2, dims, x, 0);
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matvar) == NULL) << "Error creating variable for ’x’";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matvar) == NULL) << "Error creating variable for ’x’";
|
||||
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
Mat_Close(matfp);
|
||||
@@ -59,16 +59,16 @@ TEST(MatioTest, WriteAndReadDoubles)
|
||||
matvar_t *matvar_read;
|
||||
|
||||
matfp_read = Mat_Open(filename.c_str(), MAT_ACC_RDONLY);
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matfp_read) == NULL) << "Error reading .mat file";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matfp_read) == NULL) << "Error reading .mat file";
|
||||
|
||||
matvar_read = Mat_VarReadInfo(matfp_read, "x");
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matvar_read) == NULL) << "Error reading variable in .mat file";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matvar_read) == NULL) << "Error reading variable in .mat file";
|
||||
|
||||
matvar_read = Mat_VarRead(matfp_read, "x");
|
||||
double *x_read = reinterpret_cast<double*>(matvar_read->data);
|
||||
double *x_read = reinterpret_cast<double *>(matvar_read->data);
|
||||
Mat_Close(matfp_read);
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
EXPECT_DOUBLE_EQ(x[i], x_read[i]);
|
||||
}
|
||||
@@ -84,9 +84,9 @@ TEST(MatioTest, WriteAndReadGrComplex)
|
||||
matvar_t *matvar1;
|
||||
std::string filename = "./test3.mat";
|
||||
matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matfp) == NULL) << "Error creating .mat file";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matfp) == NULL) << "Error creating .mat file";
|
||||
|
||||
std::vector<gr_complex> x_v = { {1, 10}, {2, 9}, {3, 8}, {4, 7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}};
|
||||
std::vector<gr_complex> x_v = {{1, 10}, {2, 9}, {3, 8}, {4, 7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}};
|
||||
const unsigned int size = x_v.size();
|
||||
float x_real[size];
|
||||
float x_imag[size];
|
||||
@@ -101,9 +101,9 @@ TEST(MatioTest, WriteAndReadGrComplex)
|
||||
struct mat_complex_split_t x = {x_real, x_imag};
|
||||
size_t dims[2] = {static_cast<size_t>(size), 1};
|
||||
matvar1 = Mat_VarCreate("x", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, &x, MAT_F_COMPLEX);
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matvar1) == NULL) << "Error creating variable for ’x’";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matvar1) == NULL) << "Error creating variable for ’x’";
|
||||
|
||||
std::vector<gr_complex> x2 = { {1.1, -10}, {2, -9}, {3, -8}, {4, -7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}};
|
||||
std::vector<gr_complex> x2 = {{1.1, -10}, {2, -9}, {3, -8}, {4, -7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}};
|
||||
const unsigned int size_y = x2.size();
|
||||
float y_real[size_y];
|
||||
float y_imag[size_y];
|
||||
@@ -119,10 +119,10 @@ TEST(MatioTest, WriteAndReadGrComplex)
|
||||
size_t dims_y[2] = {static_cast<size_t>(size_y), 1};
|
||||
matvar_t *matvar2;
|
||||
matvar2 = Mat_VarCreate("y", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims_y, &y, MAT_F_COMPLEX);
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matvar2) == NULL) << "Error creating variable for ’y’";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matvar2) == NULL) << "Error creating variable for ’y’";
|
||||
|
||||
Mat_VarWrite(matfp, matvar1, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar2, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar1, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarWrite(matfp, matvar2, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar1);
|
||||
Mat_VarFree(matvar2);
|
||||
|
||||
@@ -133,17 +133,17 @@ TEST(MatioTest, WriteAndReadGrComplex)
|
||||
matvar_t *matvar_read;
|
||||
|
||||
matfp_read = Mat_Open(filename.c_str(), MAT_ACC_RDONLY);
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matfp_read) == NULL) << "Error reading .mat file";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matfp_read) == NULL) << "Error reading .mat file";
|
||||
|
||||
matvar_read = Mat_VarReadInfo(matfp_read, "x");
|
||||
ASSERT_FALSE(reinterpret_cast<long*>(matvar_read) == NULL) << "Error reading variable in .mat file";
|
||||
ASSERT_FALSE(reinterpret_cast<long *>(matvar_read) == NULL) << "Error reading variable in .mat file";
|
||||
|
||||
matvar_read = Mat_VarRead(matfp_read, "x");
|
||||
mat_complex_split_t *x_read_st = reinterpret_cast<mat_complex_split_t*>(matvar_read->data);
|
||||
float * x_read_real = reinterpret_cast<float*>(x_read_st->Re);
|
||||
float * x_read_imag = reinterpret_cast<float*>(x_read_st->Im);
|
||||
mat_complex_split_t *x_read_st = reinterpret_cast<mat_complex_split_t *>(matvar_read->data);
|
||||
float *x_read_real = reinterpret_cast<float *>(x_read_st->Re);
|
||||
float *x_read_imag = reinterpret_cast<float *>(x_read_st->Im);
|
||||
std::vector<gr_complex> x_v_read;
|
||||
for(unsigned int i = 0; i < size; i++)
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
x_v_read.push_back(gr_complex(x_read_real[i], x_read_imag[i]));
|
||||
}
|
||||
@@ -151,7 +151,7 @@ TEST(MatioTest, WriteAndReadGrComplex)
|
||||
Mat_Close(matfp_read);
|
||||
Mat_VarFree(matvar_read);
|
||||
|
||||
for(unsigned int i = 0; i < size; i++)
|
||||
for (unsigned int i = 0; i < size; i++)
|
||||
{
|
||||
EXPECT_FLOAT_EQ(x_v[i].real(), x_v_read[i].real());
|
||||
EXPECT_FLOAT_EQ(x_v[i].imag(), x_v_read[i].imag());
|
||||
|
||||
@@ -49,7 +49,7 @@ TEST(MultiplyTest, StandardCDoubleImplementation)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for(int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
{
|
||||
output[i] = input[i] * input[i];
|
||||
}
|
||||
@@ -62,7 +62,7 @@ TEST(MultiplyTest, StandardCDoubleImplementation)
|
||||
|
||||
double acc = 0;
|
||||
double expected = 0;
|
||||
for(int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
{
|
||||
acc += output[i];
|
||||
}
|
||||
@@ -89,11 +89,10 @@ TEST(MultiplyTest, ArmadilloImplementation)
|
||||
<< "-length double Armadillo vectors finished in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
ASSERT_EQ(0, arma::norm(output,2));
|
||||
ASSERT_EQ(0, arma::norm(output, 2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(MultiplyTest, StandardCComplexImplementation)
|
||||
{
|
||||
std::complex<float>* input = new std::complex<float>[FLAGS_size_multiply_test];
|
||||
@@ -102,7 +101,7 @@ TEST(MultiplyTest, StandardCComplexImplementation)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
for(int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
for (int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
{
|
||||
output[i] = input[i] * input[i];
|
||||
}
|
||||
@@ -113,12 +112,12 @@ TEST(MultiplyTest, StandardCComplexImplementation)
|
||||
<< " complex<float> in standard C finished in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
|
||||
std::complex<float> expected(0,0);
|
||||
std::complex<float> result(0,0);
|
||||
for(int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
{
|
||||
result += output[i];
|
||||
}
|
||||
std::complex<float> expected(0, 0);
|
||||
std::complex<float> result(0, 0);
|
||||
for (int i = 0; i < FLAGS_size_multiply_test; i++)
|
||||
{
|
||||
result += output[i];
|
||||
}
|
||||
delete[] input;
|
||||
delete[] output;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
@@ -126,7 +125,6 @@ TEST(MultiplyTest, StandardCComplexImplementation)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(MultiplyTest, C11ComplexImplementation)
|
||||
{
|
||||
const std::vector<std::complex<float>> input(FLAGS_size_multiply_test);
|
||||
@@ -136,7 +134,7 @@ TEST(MultiplyTest, C11ComplexImplementation)
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
// Trying a range-based for
|
||||
for (const auto &item : input)
|
||||
for (const auto& item : input)
|
||||
{
|
||||
output[pos++] = item * item;
|
||||
}
|
||||
@@ -148,7 +146,7 @@ TEST(MultiplyTest, C11ComplexImplementation)
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
|
||||
std::complex<float> expected(0,0);
|
||||
std::complex<float> expected(0, 0);
|
||||
auto result = std::inner_product(output.begin(), output.end(), output.begin(), expected);
|
||||
ASSERT_EQ(expected, result);
|
||||
}
|
||||
@@ -170,12 +168,10 @@ TEST(MultiplyTest, ArmadilloComplexImplementation)
|
||||
<< "-length complex float Armadillo vectors finished in " << elapsed_seconds.count() * 1e6
|
||||
<< " microseconds" << std::endl;
|
||||
ASSERT_LE(0, elapsed_seconds.count() * 1e6);
|
||||
ASSERT_EQ(0, arma::norm(output,2));
|
||||
ASSERT_EQ(0, arma::norm(output, 2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TEST(MultiplyTest, VolkComplexImplementation)
|
||||
{
|
||||
std::complex<float>* input = static_cast<std::complex<float>*>(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(std::complex<float>), volk_gnsssdr_get_alignment()));
|
||||
@@ -208,4 +204,3 @@ TEST(MultiplyTest, VolkComplexImplementation)
|
||||
volk_gnsssdr_free(output);
|
||||
volk_gnsssdr_free(mag);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
#include "control_message_factory.h"
|
||||
|
||||
|
||||
|
||||
|
||||
TEST(ControlMessageFactoryTest, GetQueueMessage)
|
||||
{
|
||||
std::shared_ptr<ControlMessageFactory> factory = std::make_shared<ControlMessageFactory>();
|
||||
@@ -51,8 +49,6 @@ TEST(ControlMessageFactoryTest, GetQueueMessage)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
TEST(ControlMessageFactoryTest, GetControlMessages)
|
||||
{
|
||||
std::shared_ptr<ControlMessageFactory> factory = std::make_shared<ControlMessageFactory>();
|
||||
|
||||
@@ -52,12 +52,13 @@
|
||||
#include "control_message_factory.h"
|
||||
|
||||
|
||||
class ControlThreadTest: public ::testing::Test
|
||||
class ControlThreadTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
static int stop_receiver();
|
||||
typedef struct {
|
||||
long mtype; // required by SysV message
|
||||
typedef struct
|
||||
{
|
||||
long mtype; // required by SysV message
|
||||
double message;
|
||||
} message_buffer;
|
||||
};
|
||||
@@ -73,7 +74,9 @@ int ControlThreadTest::stop_receiver()
|
||||
key_t key_stop = 1102;
|
||||
|
||||
// wait for the receiver control queue to be created
|
||||
while(((msqid_stop = msgget(key_stop, 0644))) == -1){ }
|
||||
while (((msqid_stop = msgget(key_stop, 0644))) == -1)
|
||||
{
|
||||
}
|
||||
|
||||
// wait for a couple of seconds
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
@@ -92,7 +95,7 @@ TEST_F(ControlThreadTest, InstantiateRunControlMessages)
|
||||
config->set_property("SignalSource.implementation", "File_Signal_Source");
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
const char* file_name = file.c_str();
|
||||
config->set_property("SignalSource.filename", file_name);
|
||||
config->set_property("SignalSource.item_type", "gr_complex");
|
||||
config->set_property("SignalSource.sampling_frequency", "4000000");
|
||||
@@ -121,23 +124,23 @@ TEST_F(ControlThreadTest, InstantiateRunControlMessages)
|
||||
|
||||
std::unique_ptr<ControlMessageFactory> control_msg_factory(new ControlMessageFactory());
|
||||
|
||||
control_queue->handle(control_msg_factory->GetQueueMessage(0,0));
|
||||
control_queue->handle(control_msg_factory->GetQueueMessage(1,0));
|
||||
control_queue->handle(control_msg_factory->GetQueueMessage(200,0));
|
||||
control_queue->handle(control_msg_factory->GetQueueMessage(0, 0));
|
||||
control_queue->handle(control_msg_factory->GetQueueMessage(1, 0));
|
||||
control_queue->handle(control_msg_factory->GetQueueMessage(200, 0));
|
||||
|
||||
control_thread->set_control_queue(control_queue);
|
||||
try
|
||||
{
|
||||
{
|
||||
control_thread->run();
|
||||
}
|
||||
catch(const boost::exception & e)
|
||||
{
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
|
||||
unsigned int expected3 = 3;
|
||||
unsigned int expected1 = 1;
|
||||
@@ -152,7 +155,7 @@ TEST_F(ControlThreadTest, InstantiateRunControlMessages2)
|
||||
config->set_property("SignalSource.implementation", "File_Signal_Source");
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
const char* file_name = file.c_str();
|
||||
config->set_property("SignalSource.filename", file_name);
|
||||
config->set_property("SignalSource.item_type", "gr_complex");
|
||||
config->set_property("SignalSource.sampling_frequency", "4000000");
|
||||
@@ -181,26 +184,26 @@ TEST_F(ControlThreadTest, InstantiateRunControlMessages2)
|
||||
|
||||
std::unique_ptr<ControlMessageFactory> control_msg_factory2(new ControlMessageFactory());
|
||||
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(0,0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(2,0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(1,0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(3,0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(200,0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(0, 0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(2, 0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(1, 0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(3, 0));
|
||||
control_queue2->handle(control_msg_factory2->GetQueueMessage(200, 0));
|
||||
|
||||
control_thread2->set_control_queue(control_queue2);
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
control_thread2->run();
|
||||
}
|
||||
catch(const boost::exception & e)
|
||||
{
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
|
||||
unsigned int expected5 = 5;
|
||||
unsigned int expected1 = 1;
|
||||
@@ -209,14 +212,13 @@ TEST_F(ControlThreadTest, InstantiateRunControlMessages2)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_F(ControlThreadTest, StopReceiverProgrammatically)
|
||||
{
|
||||
std::shared_ptr<InMemoryConfiguration> config = std::make_shared<InMemoryConfiguration>();
|
||||
config->set_property("SignalSource.implementation", "File_Signal_Source");
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
const char* file_name = file.c_str();
|
||||
config->set_property("SignalSource.filename", file_name);
|
||||
config->set_property("SignalSource.item_type", "gr_complex");
|
||||
config->set_property("SignalSource.sampling_frequency", "4000000");
|
||||
@@ -246,17 +248,17 @@ TEST_F(ControlThreadTest, StopReceiverProgrammatically)
|
||||
std::thread stop_receiver_thread(stop_receiver);
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
control_thread->run();
|
||||
}
|
||||
catch(const boost::exception & e)
|
||||
{
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(const std::exception & ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
|
||||
stop_receiver_thread.join();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "file_configuration.h"
|
||||
|
||||
|
||||
|
||||
TEST(FileConfigurationTest, OverridedProperties)
|
||||
{
|
||||
std::string path = std::string(TEST_PATH);
|
||||
@@ -50,7 +49,6 @@ TEST(FileConfigurationTest, OverridedProperties)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(FileConfigurationTest, LoadFromNonExistentFile)
|
||||
{
|
||||
std::unique_ptr<ConfigurationInterface> configuration(new FileConfiguration("./i_dont_exist.conf"));
|
||||
@@ -60,7 +58,6 @@ TEST(FileConfigurationTest, LoadFromNonExistentFile)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(FileConfigurationTest, PropertyDoesNotExist)
|
||||
{
|
||||
std::string path = std::string(TEST_PATH);
|
||||
|
||||
@@ -146,8 +146,8 @@ TEST(GNSSBlockFactoryTest, InstantiateFreqXlatingFIRFilter)
|
||||
configuration->set_property("InputFilter.filter_type", "bandpass");
|
||||
configuration->set_property("InputFilter.grid_density", "16");
|
||||
|
||||
configuration->set_property("InputFilter.sampling_frequency","4000000");
|
||||
configuration->set_property("InputFilter.IF","34000");
|
||||
configuration->set_property("InputFilter.sampling_frequency", "4000000");
|
||||
configuration->set_property("InputFilter.IF", "34000");
|
||||
std::unique_ptr<GNSSBlockFactory> factory;
|
||||
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Freq_Xlating_Fir_Filter", 1, 1);
|
||||
|
||||
@@ -316,8 +316,8 @@ TEST(GNSSBlockFactoryTest, InstantiateChannels)
|
||||
configuration->set_property("Channels_1C.count", "2");
|
||||
configuration->set_property("Channels_1E.count", "0");
|
||||
configuration->set_property("Channels.in_acquisition", "2");
|
||||
configuration->set_property("Tracking_1C.implementation","GPS_L1_CA_DLL_PLL_C_Aid_Tracking");
|
||||
configuration->set_property("TelemetryDecoder_1C.implementation","GPS_L1_CA_Telemetry_Decoder");
|
||||
configuration->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking");
|
||||
configuration->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||
configuration->set_property("Channel0.item_type", "gr_complex");
|
||||
configuration->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
configuration->set_property("Channel1.item_type", "gr_complex");
|
||||
|
||||
@@ -278,4 +278,3 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStopHybrid)
|
||||
flowgraph->stop();
|
||||
EXPECT_FALSE(flowgraph->running());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "string_converter.h"
|
||||
|
||||
|
||||
|
||||
TEST(StringConverterTest, StringToBool)
|
||||
{
|
||||
std::unique_ptr<StringConverter> converter(new StringConverter());
|
||||
|
||||
+52
-51
@@ -63,9 +63,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
~GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -78,21 +79,20 @@ GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1Pcps8msAmb
|
||||
void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -100,12 +100,13 @@ GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1Pcps8msAmbiguo
|
||||
}
|
||||
|
||||
GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx::~GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test: public ::testing::Test
|
||||
class GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test()
|
||||
@@ -119,7 +120,8 @@ protected:
|
||||
}
|
||||
|
||||
~GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void config_1();
|
||||
@@ -193,7 +195,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -260,7 +262,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_2()
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 100;
|
||||
@@ -351,13 +353,13 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::wait_message()
|
||||
start = std::chrono::system_clock::now();
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
channel_internal_queue.wait_and_pop(message);
|
||||
}
|
||||
catch( const boost::exception & e )
|
||||
{
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
LOG(WARNING) << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
}
|
||||
|
||||
end = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
@@ -376,7 +378,7 @@ 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 = std::abs(static_cast<double>(expected_delay_chips) - (static_cast<double>(gnss_synchro.Acq_delay_samples) - 5) * 1023.0 / (static_cast<double>(fs_in)*1e-3));
|
||||
double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - (static_cast<double>(gnss_synchro.Acq_delay_samples) - 5) * 1023.0 / (static_cast<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);
|
||||
@@ -436,27 +438,27 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -465,14 +467,14 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -486,33 +488,33 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -530,19 +532,19 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
//acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
@@ -554,7 +556,6 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
@@ -575,33 +576,33 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -621,19 +622,19 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
//acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
stop_queue();
|
||||
if (i == 0)
|
||||
|
||||
+71
-70
@@ -60,13 +60,14 @@ GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguous
|
||||
class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(concurrent_queue<int>& queue );
|
||||
friend GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(concurrent_queue<int>& queue);
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
~GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -79,21 +80,20 @@ GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguous
|
||||
void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -101,13 +101,14 @@ GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1PcpsAmbiguousAcqu
|
||||
}
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::~GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test: public ::testing::Test
|
||||
class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test()
|
||||
@@ -120,7 +121,8 @@ protected:
|
||||
}
|
||||
|
||||
~GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void config_1();
|
||||
@@ -194,7 +196,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -213,9 +215,9 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "44");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.noise_flag", "false");
|
||||
config->set_property("SignalSource.data_flag", "false");
|
||||
@@ -243,9 +245,9 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag", "false");
|
||||
config->set_property("Acquisition_1B.threshold", "0.1");
|
||||
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||
@@ -284,9 +286,9 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "44");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.system_1", "E");
|
||||
config->set_property("SignalSource.PRN_1", "15");
|
||||
@@ -332,9 +334,9 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2()
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag", "false");
|
||||
config->set_property("Acquisition_1B.pfa", "0.1");
|
||||
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||
@@ -379,7 +381,7 @@ 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 = std::abs(static_cast<double>(expected_delay_chips) - (static_cast<double>(gnss_synchro.Acq_delay_samples)- 5 ) * 1023.0 / static_cast<double>(fs_in*1e-3));
|
||||
double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - (static_cast<double>(gnss_synchro.Acq_delay_samples) - 5) * 1023.0 / static_cast<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);
|
||||
@@ -402,7 +404,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message()
|
||||
|
||||
Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
|
||||
Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
|
||||
Pfa_p = static_cast<double>(detection_counter-correct_estimation_counter) / static_cast<double>(num_of_realizations);
|
||||
Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
|
||||
|
||||
mean_acq_time_us /= static_cast<double>(num_of_realizations);
|
||||
|
||||
@@ -428,7 +430,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
{
|
||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
||||
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
@@ -439,7 +441,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -448,14 +450,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -468,33 +470,33 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -512,39 +514,38 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
stop_queue();
|
||||
if (i == 0)
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
ch_thread.join();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
||||
{
|
||||
config_2();
|
||||
@@ -554,33 +555,33 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -600,34 +601,34 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
ch_thread.join();
|
||||
}
|
||||
}
|
||||
|
||||
+35
-34
@@ -72,9 +72,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx(); //!< Default destructor
|
||||
~GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -87,21 +88,20 @@ GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_sptr GalileoE1PcpsAmbiguousAcqu
|
||||
void GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx::GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx::GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx(concurrent_queue<int>& queue) : gr::block("GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -109,13 +109,14 @@ GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx::GalileoE1PcpsAmbiguousAcquisit
|
||||
}
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx::~GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
class GalileoE1PcpsAmbiguousAcquisitionGSoCTest: public ::testing::Test
|
||||
class GalileoE1PcpsAmbiguousAcquisitionGSoCTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE1PcpsAmbiguousAcquisitionGSoCTest()
|
||||
@@ -129,7 +130,8 @@ protected:
|
||||
}
|
||||
|
||||
~GalileoE1PcpsAmbiguousAcquisitionGSoCTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void start_queue();
|
||||
@@ -181,15 +183,14 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::wait_message()
|
||||
while (!stop)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
channel_internal_queue.wait_and_pop(message);
|
||||
stop_queue();
|
||||
}
|
||||
catch( const boost::exception & e )
|
||||
{
|
||||
}
|
||||
catch (const boost::exception& e)
|
||||
{
|
||||
DLOG(WARNING) << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +213,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate)
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
||||
{
|
||||
int fs_in = 4000000;
|
||||
int nsamples = 4*fs_in;
|
||||
int nsamples = 4 * fs_in;
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
queue = gr::msg_queue::make(0);
|
||||
@@ -223,7 +224,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -232,13 +233,13 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,41 +255,41 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
||||
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00001));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 250));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
std::string path = std::string(TEST_PATH);
|
||||
//std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
|
||||
std::string file = path + "signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
start_queue();
|
||||
acquisition->set_local_code();
|
||||
acquisition->init();
|
||||
@@ -296,9 +297,9 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
||||
acquisition->set_state(1);
|
||||
}) << "Failure starting acquisition";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
@@ -306,7 +307,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
||||
stop_queue();
|
||||
|
||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 0=ACQ STOP.";
|
||||
|
||||
|
||||
+46
-47
@@ -69,7 +69,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
~GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -82,20 +82,19 @@ GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisit
|
||||
void GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx() :
|
||||
gr::block("GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx() : gr::block("GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -104,26 +103,28 @@ GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::GalileoE1PcpsAmbiguousAcquisitionT
|
||||
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::~GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GalileoE1PcpsAmbiguousAcquisitionTest: public ::testing::Test
|
||||
class GalileoE1PcpsAmbiguousAcquisitionTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest()
|
||||
{
|
||||
{
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
doppler_max = 10000;
|
||||
doppler_step = 250;
|
||||
}
|
||||
}
|
||||
|
||||
~GalileoE1PcpsAmbiguousAcquisitionTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void plot_grid();
|
||||
@@ -150,7 +151,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::init()
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms", "4");
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
config->set_property("Acquisition_1B.dump", "true");
|
||||
}
|
||||
@@ -173,17 +174,17 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
|
||||
std::string basename = "./tmp-acq-gal1/acquisition_E_1B";
|
||||
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); // !!
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); // !!
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||
|
||||
if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
|
||||
std::vector<int> * doppler = &acq_dump.doppler;
|
||||
std::vector<unsigned int> * samples = &acq_dump.samples;
|
||||
std::vector<std::vector<float> > * mag = &acq_dump.mag;
|
||||
std::vector<int>* doppler = &acq_dump.doppler;
|
||||
std::vector<unsigned int>* samples = &acq_dump.samples;
|
||||
std::vector<std::vector<float> >* mag = &acq_dump.mag;
|
||||
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -193,7 +194,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
|
||||
{
|
||||
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -209,11 +210,11 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
|
||||
g1.savetops("Galileo_E1_acq_grid");
|
||||
g1.savetopdf("Galileo_E1_acq_grid");
|
||||
g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string data_str = "./tmp-acq-gal1";
|
||||
if (boost::filesystem::exists(data_str))
|
||||
@@ -223,7 +224,6 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
|
||||
{
|
||||
init();
|
||||
@@ -235,7 +235,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
|
||||
{
|
||||
int fs_in = 4000000;
|
||||
int nsamples = 4*fs_in;
|
||||
int nsamples = 4 * fs_in;
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
@@ -245,22 +245,22 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
std::string data_str = "./tmp-acq-gal1";
|
||||
if (boost::filesystem::exists(data_str))
|
||||
@@ -279,7 +279,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
boost::filesystem::create_directory(data_str);
|
||||
}
|
||||
|
||||
double expected_delay_samples = 2920; //18250;
|
||||
double expected_delay_samples = 2920; //18250;
|
||||
double expected_doppler_hz = -632;
|
||||
init();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
@@ -287,34 +287,34 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 1e-9));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", doppler_max));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", doppler_step));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
@@ -325,15 +325,15 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
acquisition->reset();
|
||||
acquisition->set_state(1);
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
|
||||
std::cout << "Delay: " << gnss_synchro.Acq_delay_samples << std::endl;
|
||||
@@ -346,9 +346,8 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
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";
|
||||
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
plot_grid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+72
-71
@@ -60,13 +60,14 @@ GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsCccwsrAmbig
|
||||
class GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(concurrent_queue<int>& queue );
|
||||
friend GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(concurrent_queue<int>& queue);
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
~GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -79,21 +80,20 @@ GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsCccwsrAmbig
|
||||
void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx::GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx::GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx(concurrent_queue<int>& queue) : gr::block("GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -101,12 +101,13 @@ GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx::GalileoE1PcpsCccwsrAmbiguous
|
||||
}
|
||||
|
||||
GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx::~GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GalileoE1PcpsCccwsrAmbiguousAcquisitionTest: public ::testing::Test
|
||||
class GalileoE1PcpsCccwsrAmbiguousAcquisitionTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE1PcpsCccwsrAmbiguousAcquisitionTest()
|
||||
@@ -188,14 +189,14 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'E';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 4;
|
||||
fs_in = 4e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -214,9 +215,9 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "44");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.noise_flag", "false");
|
||||
config->set_property("SignalSource.data_flag", "false");
|
||||
@@ -244,7 +245,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1()
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.if", "0");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.threshold", "0.7");
|
||||
@@ -266,7 +267,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_2()
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 100;
|
||||
@@ -285,9 +286,9 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_2()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "44");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.system_1", "E");
|
||||
config->set_property("SignalSource.PRN_1", "15");
|
||||
@@ -333,9 +334,9 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_2()
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||
config->set_property("Acquisition_1B.threshold", "0.00215"); // Pfa,a = 0.1
|
||||
config->set_property("Acquisition_1B.threshold", "0.00215"); // Pfa,a = 0.1
|
||||
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||
config->set_property("Acquisition_1B.dump", "false");
|
||||
@@ -402,7 +403,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::process_message()
|
||||
|
||||
Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
|
||||
Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
|
||||
Pfa_p = static_cast<double>(detection_counter-correct_estimation_counter) / static_cast<double>(num_of_realizations);
|
||||
Pfa_p = static_cast<double>(detection_counter - correct_estimation_counter) / static_cast<double>(num_of_realizations);
|
||||
|
||||
mean_acq_time_us /= num_of_realizations;
|
||||
|
||||
@@ -430,7 +431,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate)
|
||||
|
||||
TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun)
|
||||
{
|
||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
||||
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
|
||||
@@ -442,7 +443,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun)
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -451,14 +452,14 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -471,34 +472,34 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00001));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -516,11 +517,11 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
acquisition->set_local_code();
|
||||
@@ -528,32 +529,32 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
//EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
//EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
#ifdef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
}) << "Failure while waiting the queue to stop";
|
||||
#endif
|
||||
#ifndef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||
}) << "Failure while waiting the queue to stop";
|
||||
#endif
|
||||
@@ -570,34 +571,34 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00215));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -617,11 +618,11 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
@@ -631,23 +632,23 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
ch_thread.join();
|
||||
}
|
||||
}
|
||||
|
||||
+78
-77
@@ -72,9 +72,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx(); //!< Default destructor
|
||||
~GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -87,21 +88,20 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_sptr GalileoE1Pcps
|
||||
void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx::GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx::GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -110,23 +110,24 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx::GalileoE1PcpsQuic
|
||||
|
||||
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx::~GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test: public ::testing::Test
|
||||
class GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test()
|
||||
{
|
||||
{
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
item_size = sizeof(gr_complex);
|
||||
stop = false;
|
||||
message = 0;
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
init();
|
||||
}
|
||||
}
|
||||
~GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test()
|
||||
{
|
||||
}
|
||||
@@ -171,10 +172,10 @@ protected:
|
||||
double mse_doppler;
|
||||
double mse_delay;
|
||||
|
||||
double Pd; // Probability of detection
|
||||
double Pfa_p; // Probability of false alarm on present satellite
|
||||
double Pfa_a; // Probability of false alarm on absent satellite
|
||||
double Pmd; // Probability of miss detection
|
||||
double Pd; // Probability of detection
|
||||
double Pfa_p; // Probability of false alarm on present satellite
|
||||
double Pfa_a; // Probability of false alarm on absent satellite
|
||||
double Pmd; // Probability of miss detection
|
||||
|
||||
std::ofstream pdpfafile;
|
||||
unsigned int miss_detection_counter;
|
||||
@@ -213,7 +214,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_1()
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -232,9 +233,9 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_1()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "44");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.noise_flag", "false");
|
||||
config->set_property("SignalSource.data_flag", "false");
|
||||
@@ -262,9 +263,9 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_1()
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag", "false");
|
||||
config->set_property("Acquisition_1B.threshold", "1");
|
||||
config->set_property("Acquisition_1Bdoppler_max", "10000");
|
||||
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||
@@ -308,9 +309,9 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_e1_value_CN0_dB_0));
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.system_1", "E");
|
||||
config->set_property("SignalSource.PRN_1", "15");
|
||||
@@ -356,9 +357,9 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2()
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag", "false");
|
||||
config->set_property("Acquisition_1B.threshold", std::to_string(FLAGS_e1_value_threshold));
|
||||
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||
config->set_property("Acquisition_1B.doppler_step", "125");
|
||||
@@ -398,9 +399,9 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_3()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_e1_value_CN0_dB_0));
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.system_1", "E");
|
||||
config->set_property("SignalSource.PRN_1", "15");
|
||||
@@ -420,8 +421,8 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_3()
|
||||
config->set_property("SignalSource.doppler_Hz_3", "3000");
|
||||
config->set_property("SignalSource.delay_chips_3", "300");
|
||||
|
||||
config->set_property("SignalSource.noise_flag", "false");//
|
||||
config->set_property("SignalSource.data_flag", "false");//
|
||||
config->set_property("SignalSource.noise_flag", "false"); //
|
||||
config->set_property("SignalSource.data_flag", "false"); //
|
||||
config->set_property("SignalSource.BW_BB", "0.97");
|
||||
|
||||
config->set_property("InputFilter.implementation", "Fir_Filter");
|
||||
@@ -446,9 +447,9 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_3()
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||
config->set_property("Acquisition_1B.bit_transition_flag", "false");
|
||||
config->set_property("Acquisition_1B.threshold", "0.2");
|
||||
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||
config->set_property("Acquisition_1B.doppler_step", "125");
|
||||
@@ -505,7 +506,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::process_message()
|
||||
correct_estimation_counter++;
|
||||
}
|
||||
}
|
||||
else if(message == 2 && gnss_synchro.PRN == 10)
|
||||
else if (message == 2 && gnss_synchro.PRN == 10)
|
||||
{
|
||||
/*
|
||||
if ((delay_error_chips < max_delay_error_chips) && (doppler_error_hz < max_doppler_error_hz))
|
||||
@@ -555,7 +556,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate)
|
||||
TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun)
|
||||
{
|
||||
LOG(INFO) << "**Start connect and run test";
|
||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
||||
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||
std::chrono::time_point<std::chrono::system_clock> begin, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
@@ -567,20 +568,20 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun)
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source =
|
||||
gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve =
|
||||
gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
begin = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - begin;
|
||||
}) << "Failure running the top_block.";
|
||||
@@ -602,34 +603,34 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(0);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 125));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(1);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -648,11 +649,11 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
acquisition->set_local_code();
|
||||
@@ -660,8 +661,8 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
@@ -693,34 +694,34 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(50);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(5);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -738,11 +739,11 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
@@ -751,8 +752,8 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
@@ -781,33 +782,33 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -827,11 +828,11 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
@@ -840,8 +841,8 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
@@ -853,13 +854,13 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
std::cout << "Estimated probability of miss detection (satellite present) = " << Pmd << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
|
||||
if(dump_test_results)
|
||||
if (dump_test_results)
|
||||
{
|
||||
std::stringstream filenamepd;
|
||||
filenamepd.str("");
|
||||
filenamepd << "../data/test_statistics_" << gnss_synchro.System
|
||||
<< "_" << gnss_synchro.Signal << "_sat_"
|
||||
<< gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv";
|
||||
<< "_" << gnss_synchro.Signal << "_sat_"
|
||||
<< gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv";
|
||||
|
||||
pdpfafile.open(filenamepd.str().c_str(), std::ios::app | std::ios::out);
|
||||
pdpfafile << FLAGS_e1_value_threshold << "," << Pd << "," << Pfa_p << "," << Pmd << std::endl;
|
||||
@@ -871,13 +872,13 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
|
||||
if(dump_test_results)
|
||||
if (dump_test_results)
|
||||
{
|
||||
std::stringstream filenamepf;
|
||||
filenamepf.str("");
|
||||
filenamepf << "../data/test_statistics_" << gnss_synchro.System
|
||||
<< "_" << gnss_synchro.Signal << "_sat_"
|
||||
<< gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv";
|
||||
<< "_" << gnss_synchro.Signal << "_sat_"
|
||||
<< gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv";
|
||||
|
||||
pdpfafile.open(filenamepf.str().c_str(), std::ios::app | std::ios::out);
|
||||
pdpfafile << FLAGS_e1_value_threshold << "," << Pfa_a << std::endl;
|
||||
|
||||
+64
-63
@@ -66,9 +66,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
~GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -81,21 +82,20 @@ GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsTongA
|
||||
void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -104,10 +104,11 @@ GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1PcpsTongAmbig
|
||||
|
||||
|
||||
GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx::~GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
class GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test: public ::testing::Test
|
||||
class GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test()
|
||||
@@ -196,7 +197,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -215,9 +216,9 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "44");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.noise_flag", "false");
|
||||
config->set_property("SignalSource.data_flag", "false");
|
||||
@@ -245,7 +246,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_1()
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.tong_init_val", "1");
|
||||
config->set_property("Acquisition_1B.tong_max_val", "8");
|
||||
config->set_property("Acquisition_1B.threshold", "0.3");
|
||||
@@ -267,7 +268,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_2()
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 100;
|
||||
@@ -286,9 +287,9 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_2()
|
||||
config->set_property("SignalSource.PRN_0", "10");
|
||||
config->set_property("SignalSource.CN0_dB_0", "50");
|
||||
config->set_property("SignalSource.doppler_Hz_0",
|
||||
std::to_string(expected_doppler_hz));
|
||||
std::to_string(expected_doppler_hz));
|
||||
config->set_property("SignalSource.delay_chips_0",
|
||||
std::to_string(expected_delay_chips));
|
||||
std::to_string(expected_delay_chips));
|
||||
|
||||
config->set_property("SignalSource.system_1", "E");
|
||||
config->set_property("SignalSource.PRN_1", "15");
|
||||
@@ -334,10 +335,10 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_2()
|
||||
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition");
|
||||
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1B.tong_init_val", "1");
|
||||
config->set_property("Acquisition_1B.tong_max_val", "8");
|
||||
config->set_property("Acquisition_1B.threshold", "0.00028"); // Pfa,a = 0.1
|
||||
config->set_property("Acquisition_1B.threshold", "0.00028"); // Pfa,a = 0.1
|
||||
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||
config->set_property("Acquisition_1B.dump", "false");
|
||||
@@ -381,7 +382,7 @@ 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 = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<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);
|
||||
@@ -432,7 +433,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||
|
||||
TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
{
|
||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
||||
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0.0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
@@ -441,7 +442,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -449,14 +450,14 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -469,34 +470,34 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(5000);
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(100);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(0.01);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->reset();
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -514,11 +515,11 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
acquisition->reset();
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
@@ -526,21 +527,21 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
|
||||
//std::cout << "Delay: " << gnss_synchro.Acq_delay_samples << std::endl;
|
||||
//std::cout << "Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl;
|
||||
@@ -558,33 +559,33 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
|
||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00028));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -604,34 +605,34 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
ch_thread.join();
|
||||
}
|
||||
}
|
||||
|
||||
+71
-69
@@ -63,9 +63,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx(); //!< Default destructor
|
||||
~GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -78,21 +79,20 @@ GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_sptr GalileoE5aPcpsAcquisi
|
||||
void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx::GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx::GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx(concurrent_queue<int>& queue) : gr::block("GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -101,10 +101,11 @@ GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx::GalileoE5aPcpsAcquisition
|
||||
|
||||
|
||||
GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx::~GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
class GalileoE5aPcpsAcquisitionGSoC2014GensourceTest: public ::testing::Test
|
||||
class GalileoE5aPcpsAcquisitionGSoC2014GensourceTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE5aPcpsAcquisitionGSoC2014GensourceTest()
|
||||
@@ -117,7 +118,8 @@ protected:
|
||||
}
|
||||
|
||||
~GalileoE5aPcpsAcquisitionGSoC2014GensourceTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void config_1();
|
||||
@@ -199,7 +201,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'E';
|
||||
std::string signal = "5X";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 1;
|
||||
fs_in = 32e6;
|
||||
@@ -210,14 +212,14 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
|
||||
CAF_window_hz = 0;
|
||||
Zero_padding = 0;
|
||||
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
|
||||
config->set_property("Channel.signal",signal);
|
||||
config->set_property("Channel.signal", signal);
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(fs_in));
|
||||
config->set_property("SignalSource.fs_hz", std::to_string(fs_in));
|
||||
config->set_property("SignalSource.item_type", "gr_complex");
|
||||
@@ -259,11 +261,11 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
|
||||
config->set_property("Acquisition_5X.implementation", "Galileo_E5a_Noncoherent_IQ_Acquisition_CAF");
|
||||
config->set_property("Acquisition_5X.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_5X.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_5X.max_dwells", "1");
|
||||
config->set_property("Acquisition_5X.CAF_window_hz",std::to_string(CAF_window_hz));
|
||||
config->set_property("Acquisition_5X.Zero_padding",std::to_string(Zero_padding));
|
||||
config->set_property("Acquisition_5X.pfa","0.003");
|
||||
config->set_property("Acquisition_5X.CAF_window_hz", std::to_string(CAF_window_hz));
|
||||
config->set_property("Acquisition_5X.Zero_padding", std::to_string(Zero_padding));
|
||||
config->set_property("Acquisition_5X.pfa", "0.003");
|
||||
// config->set_property("Acquisition_5X.threshold", "0.01");
|
||||
config->set_property("Acquisition_5X.doppler_max", "10000");
|
||||
config->set_property("Acquisition_5X.doppler_step", "250");
|
||||
@@ -278,7 +280,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_2()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'E';
|
||||
std::string signal = "5X";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 3;
|
||||
|
||||
@@ -286,7 +288,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_2()
|
||||
|
||||
expected_delay_chips = 1000;
|
||||
expected_doppler_hz = 250;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -298,7 +300,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_2()
|
||||
config->set_property("Acquisition_5X.implementation", "Galileo_E5a_PCPS_Acquisition");
|
||||
config->set_property("Acquisition_5X.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_5X.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_5X.max_dwells", "1");
|
||||
config->set_property("Acquisition_5X.threshold", "0.1");
|
||||
config->set_property("Acquisition_5X.doppler_max", "10000");
|
||||
@@ -315,7 +317,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3()
|
||||
gnss_synchro.System = 'E';
|
||||
//std::string signal = "5Q";
|
||||
std::string signal = "5X";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 3;
|
||||
fs_in = 12e6;
|
||||
@@ -333,7 +335,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3()
|
||||
expected_delay_sec3 = 77;
|
||||
expected_doppler_hz3 = 5000;
|
||||
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 10;
|
||||
@@ -409,7 +411,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3()
|
||||
config->set_property("Acquisition_5X.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_5X.if", "0");
|
||||
config->set_property("Acquisition_5X.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_5X.max_dwells", "1");
|
||||
config->set_property("Acquisition_5X.implementation", "Galileo_E5a_PCPS_Acquisition");
|
||||
config->set_property("Acquisition_5X.threshold", "0.5");
|
||||
@@ -458,27 +460,27 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::process_message()
|
||||
double delay_error_chips = 0.0;
|
||||
double doppler_error_hz = 0.0;
|
||||
switch (sat)
|
||||
{
|
||||
case 0:
|
||||
delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
|
||||
break;
|
||||
case 1:
|
||||
delay_error_chips = std::abs(static_cast<double>(expected_delay_chips1) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
doppler_error_hz = std::abs(expected_doppler_hz1 - gnss_synchro.Acq_doppler_hz);
|
||||
break;
|
||||
case 2:
|
||||
delay_error_chips = std::abs(static_cast<double>(expected_delay_chips2) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
doppler_error_hz = std::abs(expected_doppler_hz2 - gnss_synchro.Acq_doppler_hz);
|
||||
break;
|
||||
case 3:
|
||||
delay_error_chips = std::abs(static_cast<double>(expected_delay_chips3) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<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;
|
||||
break;
|
||||
}
|
||||
{
|
||||
case 0:
|
||||
delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
|
||||
break;
|
||||
case 1:
|
||||
delay_error_chips = std::abs(static_cast<double>(expected_delay_chips1) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
doppler_error_hz = std::abs(expected_doppler_hz1 - gnss_synchro.Acq_doppler_hz);
|
||||
break;
|
||||
case 2:
|
||||
delay_error_chips = std::abs(static_cast<double>(expected_delay_chips2) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
doppler_error_hz = std::abs(expected_doppler_hz2 - gnss_synchro.Acq_doppler_hz);
|
||||
break;
|
||||
case 3:
|
||||
delay_error_chips = std::abs(static_cast<double>(expected_delay_chips3) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 10230.0 / (static_cast<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;
|
||||
break;
|
||||
}
|
||||
detection_counter++;
|
||||
|
||||
// The term -5 is here to correct the additional delay introduced by the FIR filter
|
||||
@@ -534,7 +536,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun)
|
||||
{
|
||||
config_1();
|
||||
//int nsamples = floor(5*fs_in*integration_time_ms*1e-3);
|
||||
int nsamples = 21000*3;
|
||||
int nsamples = 21000 * 3;
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 1);
|
||||
@@ -542,7 +544,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun)
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -551,14 +553,14 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -570,33 +572,33 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
|
||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 1);
|
||||
boost::shared_ptr<GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx> msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(0);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_5X.doppler_max", 5000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_5X.doppler_step", 100));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_5X.threshold", 0.0001));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
// USING THE SIGNAL GENERATOR
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -617,26 +619,26 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
|
||||
init();
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
gnss_synchro.PRN = 11; // present
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
gnss_synchro.PRN = 11; // present
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
gnss_synchro.PRN = 19; // not present
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
gnss_synchro.PRN = 19; // not present
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
|
||||
+76
-66
@@ -68,9 +68,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx(); //!< Default destructor
|
||||
~GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -83,21 +84,20 @@ GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_sptr GlonassL1CaPcpsAcquisitionGSo
|
||||
void GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx::GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx::GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -106,12 +106,13 @@ GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx::GlonassL1CaPcpsAcquisitionGSoC201
|
||||
|
||||
|
||||
GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx::~GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GlonassL1CaPcpsAcquisitionGSoC2017Test: public ::testing::Test
|
||||
class GlonassL1CaPcpsAcquisitionGSoC2017Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GlonassL1CaPcpsAcquisitionGSoC2017Test()
|
||||
@@ -140,7 +141,7 @@ protected:
|
||||
|
||||
gr::msg_queue::sptr queue;
|
||||
gr::top_block_sptr top_block;
|
||||
GlonassL1CaPcpsAcquisition *acquisition;
|
||||
GlonassL1CaPcpsAcquisition* acquisition;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
@@ -193,14 +194,14 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_1()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'R';
|
||||
std::string signal = "1G";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 1;
|
||||
fs_in = 31.75e6;
|
||||
|
||||
expected_delay_chips = 255;
|
||||
expected_doppler_hz = -1500;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -247,7 +248,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_1()
|
||||
config->set_property("Acquisition.item_type", "gr_complex");
|
||||
config->set_property("Acquisition.if", "4000000");
|
||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition.max_dwells", "1");
|
||||
config->set_property("Acquisition.implementation", "GLONASS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition.threshold", "0.8");
|
||||
@@ -263,14 +264,14 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_2()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'R';
|
||||
std::string signal = "1G";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 1;
|
||||
fs_in = 31.75e6;
|
||||
|
||||
expected_delay_chips = 374;
|
||||
expected_doppler_hz = -2000;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 100;
|
||||
@@ -335,7 +336,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_2()
|
||||
config->set_property("Acquisition.item_type", "gr_complex");
|
||||
config->set_property("Acquisition.if", "4000000");
|
||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition.max_dwells", "1");
|
||||
config->set_property("Acquisition.implementation", "GLONASS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition.pfa", "0.1");
|
||||
@@ -364,14 +365,14 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::wait_message()
|
||||
acquisition->reset();
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
begin = tv.tv_sec *1e6 + tv.tv_usec;
|
||||
begin = tv.tv_sec * 1e6 + tv.tv_usec;
|
||||
|
||||
channel_internal_queue.wait_and_pop(message);
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
end = tv.tv_sec *1e6 + tv.tv_usec;
|
||||
end = tv.tv_sec * 1e6 + tv.tv_usec;
|
||||
|
||||
mean_acq_time_us += (end-begin);
|
||||
mean_acq_time_us += (end - begin);
|
||||
|
||||
process_message();
|
||||
}
|
||||
@@ -386,7 +387,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::process_message()
|
||||
|
||||
// The term -5 is here to correct the additional delay introduced by the FIR filter
|
||||
// The value 511.0 must be a variable, chips/length
|
||||
double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - (static_cast<double>(gnss_synchro.Acq_delay_samples) - 5.0 ) * 511.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - (static_cast<double>(gnss_synchro.Acq_delay_samples) - 5.0) * 511.0 / (static_cast<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);
|
||||
@@ -409,7 +410,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::process_message()
|
||||
|
||||
Pd = static_cast<double>(correct_estimation_counter) / static_cast<double>(num_of_realizations);
|
||||
Pfa_a = static_cast<double>(detection_counter) / static_cast<double>(num_of_realizations);
|
||||
Pfa_p = (static_cast<double>(detection_counter) - static_cast<double>( correct_estimation_counter)) / static_cast<double>(num_of_realizations);
|
||||
Pfa_p = (static_cast<double>(detection_counter) - static_cast<double>(correct_estimation_counter)) / static_cast<double>(num_of_realizations);
|
||||
|
||||
mean_acq_time_us /= num_of_realizations;
|
||||
|
||||
@@ -445,7 +446,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun)
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -454,14 +455,14 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
begin = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - begin;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
|
||||
delete acquisition;
|
||||
}
|
||||
@@ -476,34 +477,34 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults)
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(10000);
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(500);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(0.5);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -520,19 +521,19 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
if (i == 0)
|
||||
@@ -542,19 +543,18 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
#ifdef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
}) << "Failure while waiting the queue to stop.";
|
||||
#endif
|
||||
#ifndef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||
}) << "Failure while waiting the queue to stop";
|
||||
#endif
|
||||
@@ -572,41 +572,48 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities)
|
||||
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel."<< std::endl;
|
||||
}) << "Failure setting channel."
|
||||
<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
||||
}) << "Failure setting gnss_synchro."
|
||||
<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max."<< std::endl;
|
||||
}) << "Failure setting doppler_max."
|
||||
<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step."<< std::endl;
|
||||
}) << "Failure setting doppler_step."
|
||||
<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
||||
}) << "Failure setting threshold."<< std::endl;
|
||||
}) << "Failure setting threshold."
|
||||
<< std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
||||
}) << "Failure connecting acquisition to the top_block."
|
||||
<< std::endl;
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
||||
signal_source->connect(top_block);
|
||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
||||
}) << "Failure connecting the blocks of acquisition test."
|
||||
<< std::endl;
|
||||
|
||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||
|
||||
@@ -618,43 +625,46 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 1; // This satellite is not visible
|
||||
gnss_synchro.PRN = 1; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block."<< std::endl;
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block."
|
||||
<< std::endl;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl; }
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
#ifdef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
||||
}) << "Failure while waiting the queue to stop"
|
||||
<< std::endl;
|
||||
#endif
|
||||
#ifndef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
||||
}) << "Failure while waiting the queue to stop"
|
||||
<< std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
delete acquisition;
|
||||
}
|
||||
|
||||
|
||||
+29
-27
@@ -62,9 +62,10 @@ private:
|
||||
friend GlonassL1CaPcpsAcquisitionTest_msg_rx_sptr GlonassL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GlonassL1CaPcpsAcquisitionTest_msg_rx();
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GlonassL1CaPcpsAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
~GlonassL1CaPcpsAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -77,20 +78,19 @@ GlonassL1CaPcpsAcquisitionTest_msg_rx_sptr GlonassL1CaPcpsAcquisitionTest_msg_rx
|
||||
void GlonassL1CaPcpsAcquisitionTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
std::cout << "msg_handler_telemetry Bad any cast!" << std::endl;
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GlonassL1CaPcpsAcquisitionTest_msg_rx::GlonassL1CaPcpsAcquisitionTest_msg_rx() :
|
||||
gr::block("GlonassL1CaPcpsAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GlonassL1CaPcpsAcquisitionTest_msg_rx::GlonassL1CaPcpsAcquisitionTest_msg_rx() : gr::block("GlonassL1CaPcpsAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GlonassL1CaPcpsAcquisitionTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -99,12 +99,13 @@ GlonassL1CaPcpsAcquisitionTest_msg_rx::GlonassL1CaPcpsAcquisitionTest_msg_rx() :
|
||||
|
||||
|
||||
GlonassL1CaPcpsAcquisitionTest_msg_rx::~GlonassL1CaPcpsAcquisitionTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GlonassL1CaPcpsAcquisitionTest: public ::testing::Test
|
||||
class GlonassL1CaPcpsAcquisitionTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GlonassL1CaPcpsAcquisitionTest()
|
||||
@@ -116,7 +117,8 @@ protected:
|
||||
}
|
||||
|
||||
~GlonassL1CaPcpsAcquisitionTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
@@ -170,7 +172,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ConnectAndRun)
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition = boost::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition_1G", 1, 1);
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -179,14 +181,14 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
begin = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - begin;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,52 +205,52 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
|
||||
boost::shared_ptr<GlonassL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GlonassL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(0.005);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(10000);
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(500);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
begin = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - begin;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
|
||||
ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
|
||||
|
||||
+71
-70
@@ -68,9 +68,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
~GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -83,21 +84,20 @@ GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsAcquisitionGSoC2013Tes
|
||||
void GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -105,12 +105,13 @@ GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsAcquisitionGSoC2013Test_ms
|
||||
}
|
||||
|
||||
GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx::~GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CaPcpsAcquisitionGSoC2013Test: public ::testing::Test
|
||||
class GpsL1CaPcpsAcquisitionGSoC2013Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GpsL1CaPcpsAcquisitionGSoC2013Test()
|
||||
@@ -139,7 +140,7 @@ protected:
|
||||
|
||||
gr::msg_queue::sptr queue;
|
||||
gr::top_block_sptr top_block;
|
||||
GpsL1CaPcpsAcquisition *acquisition;
|
||||
GpsL1CaPcpsAcquisition* acquisition;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
@@ -192,14 +193,14 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_1()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 1;
|
||||
fs_in = 4e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -246,7 +247,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_1()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||
config->set_property("Acquisition_1C.threshold", "0.8");
|
||||
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||
@@ -261,14 +262,14 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_2()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 1;
|
||||
fs_in = 4e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 100;
|
||||
@@ -333,7 +334,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_2()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||
config->set_property("Acquisition_1C.pfa", "0.1");
|
||||
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||
@@ -380,7 +381,7 @@ 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 = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) *1023.0 / (static_cast<double>(fs_in) * 1e-3));
|
||||
double delay_error_chips = std::abs(static_cast<double>(expected_delay_chips) - static_cast<double>(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / (static_cast<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);
|
||||
@@ -429,7 +430,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, Instantiate)
|
||||
|
||||
TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
{
|
||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
||||
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
queue = gr::msg_queue::make(0);
|
||||
@@ -439,7 +440,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -448,14 +449,14 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
|
||||
delete acquisition;
|
||||
}
|
||||
@@ -470,34 +471,34 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(10000);
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(500);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(0.5);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -514,41 +515,40 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
#ifdef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
}) << "Failure while waiting the queue to stop";
|
||||
#endif
|
||||
#ifndef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||
}) << "Failure while waiting the queue to stop";
|
||||
#endif
|
||||
@@ -566,41 +566,41 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
||||
signal_source->connect(top_block);
|
||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||
}) << "Failure connecting the blocks of acquisition test." ;
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||
|
||||
@@ -612,38 +612,39 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl; }
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
#ifdef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
}) << "Failure while waiting the queue to stop";
|
||||
#endif
|
||||
#ifndef OLD_BOOST
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||
}) << "Failure while waiting the queue to stop";
|
||||
#endif
|
||||
|
||||
+40
-40
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
@@ -68,9 +67,10 @@ private:
|
||||
friend GpsL1CaPcpsAcquisitionTest_msg_rx_sptr GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CaPcpsAcquisitionTest_msg_rx();
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CaPcpsAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
~GpsL1CaPcpsAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -83,20 +83,19 @@ GpsL1CaPcpsAcquisitionTest_msg_rx_sptr GpsL1CaPcpsAcquisitionTest_msg_rx_make()
|
||||
void GpsL1CaPcpsAcquisitionTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast &e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionTest_msg_rx::GpsL1CaPcpsAcquisitionTest_msg_rx() :
|
||||
gr::block("GpsL1CaPcpsAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GpsL1CaPcpsAcquisitionTest_msg_rx::GpsL1CaPcpsAcquisitionTest_msg_rx() : gr::block("GpsL1CaPcpsAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CaPcpsAcquisitionTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -105,12 +104,13 @@ GpsL1CaPcpsAcquisitionTest_msg_rx::GpsL1CaPcpsAcquisitionTest_msg_rx() :
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionTest_msg_rx::~GpsL1CaPcpsAcquisitionTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CaPcpsAcquisitionTest: public ::testing::Test
|
||||
class GpsL1CaPcpsAcquisitionTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GpsL1CaPcpsAcquisitionTest()
|
||||
@@ -124,7 +124,8 @@ protected:
|
||||
}
|
||||
|
||||
~GpsL1CaPcpsAcquisitionTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void plot_grid();
|
||||
@@ -150,7 +151,7 @@ void GpsL1CaPcpsAcquisitionTest::init()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms", "1");
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
config->set_property("Acquisition_1C.dump", "true");
|
||||
}
|
||||
@@ -173,17 +174,17 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||
std::string basename = "./tmp-acq-gps1/acquisition_G_1C";
|
||||
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !!
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !!
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||
|
||||
if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
|
||||
std::vector<int> *doppler = &acq_dump.doppler;
|
||||
std::vector<unsigned int> *samples = &acq_dump.samples;
|
||||
std::vector<std::vector<float> > *mag = &acq_dump.mag;
|
||||
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -193,7 +194,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||
{
|
||||
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -209,11 +210,11 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||
g1.savetops("GPS_L1_acq_grid");
|
||||
g1.savetopdf("GPS_L1_acq_grid");
|
||||
g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
}
|
||||
catch (const GnuplotException &ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string data_str = "./tmp-acq-gps1";
|
||||
if (boost::filesystem::exists(data_str))
|
||||
@@ -243,24 +244,23 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
|
||||
init();
|
||||
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
std::string data_str = "./tmp-acq-gps1";
|
||||
if (boost::filesystem::exists(data_str))
|
||||
@@ -288,52 +288,52 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(0.001);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(doppler_max);
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(doppler_step);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
const char *file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->init();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
|
||||
double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples);
|
||||
@@ -343,7 +343,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||
EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";
|
||||
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
||||
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
plot_grid();
|
||||
}
|
||||
|
||||
+77
-69
@@ -50,20 +50,20 @@
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#define DMA_ACQ_TRANSFER_SIZE 2046 // DMA transfer size for the acquisition
|
||||
#define RX_SIGNAL_MAX_VALUE 127 // 2^7 - 1 for 8-bit signed values
|
||||
#define NTIMES_CYCLE_THROUGH_RX_SAMPLES_FILE 50 // number of times we cycle through the file containing the received samples
|
||||
#define ONE_SECOND 1000000 // one second in microseconds
|
||||
#define FLOAT_SIZE (sizeof(float)) // size of the float variable in characters
|
||||
#define DMA_ACQ_TRANSFER_SIZE 2046 // DMA transfer size for the acquisition
|
||||
#define RX_SIGNAL_MAX_VALUE 127 // 2^7 - 1 for 8-bit signed values
|
||||
#define NTIMES_CYCLE_THROUGH_RX_SAMPLES_FILE 50 // number of times we cycle through the file containing the received samples
|
||||
#define ONE_SECOND 1000000 // one second in microseconds
|
||||
#define FLOAT_SIZE (sizeof(float)) // size of the float variable in characters
|
||||
|
||||
// thread that reads the file containing the received samples, scales the samples to the dynamic range of the fixed point values, sends
|
||||
// the samples to the DMA and finally it stops the top block
|
||||
void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block,
|
||||
const char * file_name)
|
||||
const char *file_name)
|
||||
{
|
||||
FILE *rx_signal_file; // file descriptor
|
||||
int file_length; // length of the file containing the received samples
|
||||
int dma_descr; // DMA descriptor
|
||||
FILE *rx_signal_file; // file descriptor
|
||||
int file_length; // length of the file containing the received samples
|
||||
int dma_descr; // DMA descriptor
|
||||
|
||||
// sleep for 1 second to give some time to GNSS-SDR to activate the acquisition module.
|
||||
// the acquisition module does not block the RX buffer before activation.
|
||||
@@ -72,15 +72,15 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block,
|
||||
// we want for the test
|
||||
usleep(ONE_SECOND);
|
||||
|
||||
char *buffer_float; // temporary buffer to convert from binary char to float and from float to char
|
||||
signed char *buffer_DMA; // temporary buffer to store the samples to be sent to the DMA
|
||||
buffer_float = (char *) malloc(FLOAT_SIZE); // allocate space for the temporary buffer
|
||||
char *buffer_float; // temporary buffer to convert from binary char to float and from float to char
|
||||
signed char *buffer_DMA; // temporary buffer to store the samples to be sent to the DMA
|
||||
buffer_float = (char *)malloc(FLOAT_SIZE); // allocate space for the temporary buffer
|
||||
if (!buffer_float)
|
||||
{
|
||||
fprintf(stderr, "Memory error!");
|
||||
}
|
||||
|
||||
rx_signal_file = fopen(file_name, "rb"); // file containing the received signal
|
||||
rx_signal_file = fopen(file_name, "rb"); // file containing the received signal
|
||||
if (!rx_signal_file)
|
||||
{
|
||||
printf("Unable to open file!");
|
||||
@@ -95,7 +95,7 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block,
|
||||
|
||||
float max = 0;
|
||||
float *pointer_float;
|
||||
pointer_float = (float *) &buffer_float[0];
|
||||
pointer_float = (float *)&buffer_float[0];
|
||||
for (int k = 0; k < file_length; k = k + FLOAT_SIZE)
|
||||
{
|
||||
fread(buffer_float, FLOAT_SIZE, 1, rx_signal_file);
|
||||
@@ -111,7 +111,7 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block,
|
||||
|
||||
// allocate memory for the samples to be transferred to the DMA
|
||||
|
||||
buffer_DMA = (signed char *) malloc(DMA_ACQ_TRANSFER_SIZE);
|
||||
buffer_DMA = (signed char *)malloc(DMA_ACQ_TRANSFER_SIZE);
|
||||
if (!buffer_DMA)
|
||||
{
|
||||
fprintf(stderr, "Memory error!");
|
||||
@@ -182,16 +182,17 @@ private:
|
||||
friend GpsL1CaPcpsAcquisitionTest_msg_fpga_rx_sptr GpsL1CaPcpsAcquisitionTestFpga_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CaPcpsAcquisitionTestFpga_msg_rx();
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CaPcpsAcquisitionTestFpga_msg_rx(); //!< Default destructor
|
||||
~GpsL1CaPcpsAcquisitionTestFpga_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionTest_msg_fpga_rx_sptr GpsL1CaPcpsAcquisitionTestFpga_msg_rx_make()
|
||||
{
|
||||
return GpsL1CaPcpsAcquisitionTest_msg_fpga_rx_sptr(
|
||||
new GpsL1CaPcpsAcquisitionTestFpga_msg_rx());
|
||||
new GpsL1CaPcpsAcquisitionTestFpga_msg_rx());
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +203,7 @@ void GpsL1CaPcpsAcquisitionTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
catch (boost::bad_any_cast &e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
@@ -210,20 +211,20 @@ void GpsL1CaPcpsAcquisitionTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionTestFpga_msg_rx::GpsL1CaPcpsAcquisitionTestFpga_msg_rx() :
|
||||
gr::block("GpsL1CaPcpsAcquisitionTestFpga_msg_rx",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(0, 0, 0))
|
||||
GpsL1CaPcpsAcquisitionTestFpga_msg_rx::GpsL1CaPcpsAcquisitionTestFpga_msg_rx() : gr::block("GpsL1CaPcpsAcquisitionTestFpga_msg_rx",
|
||||
gr::io_signature::make(0, 0, 0),
|
||||
gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"),
|
||||
boost::bind( &GpsL1CaPcpsAcquisitionTestFpga_msg_rx::msg_handler_events, this, _1));
|
||||
boost::bind(&GpsL1CaPcpsAcquisitionTestFpga_msg_rx::msg_handler_events, this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionTestFpga_msg_rx::~GpsL1CaPcpsAcquisitionTestFpga_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
class GpsL1CaPcpsAcquisitionTestFpga : public ::testing::Test
|
||||
@@ -238,7 +239,8 @@ protected:
|
||||
}
|
||||
|
||||
~GpsL1CaPcpsAcquisitionTestFpga()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
@@ -276,7 +278,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, Instantiate)
|
||||
{
|
||||
init();
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionFpga> acquisition =
|
||||
boost::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition_1C", 0, 1);
|
||||
boost::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition_1C", 0, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -290,40 +292,46 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults)
|
||||
double expected_doppler_hz = 1680;
|
||||
init();
|
||||
|
||||
std::shared_ptr < GpsL1CaPcpsAcquisitionFpga > acquisition =
|
||||
std::make_shared < GpsL1CaPcpsAcquisitionFpga > (config.get(), "Acquisition_1C", 0, 1);
|
||||
std::shared_ptr<GpsL1CaPcpsAcquisitionFpga> acquisition =
|
||||
std::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition_1C", 0, 1);
|
||||
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTestFpga_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTestFpga_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
acquisition->set_channel(1);
|
||||
})<< "Failure setting channel.";
|
||||
{
|
||||
acquisition->set_channel(1);
|
||||
})
|
||||
<< "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
})<< "Failure setting gnss_synchro.";
|
||||
{
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
})
|
||||
<< "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
acquisition->set_threshold(0.1);
|
||||
})<< "Failure setting threshold.";
|
||||
{
|
||||
acquisition->set_threshold(0.1);
|
||||
})
|
||||
<< "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
acquisition->set_doppler_max(10000);
|
||||
})<< "Failure setting doppler_max.";
|
||||
{
|
||||
acquisition->set_doppler_max(10000);
|
||||
})
|
||||
<< "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
acquisition->set_doppler_step(250);
|
||||
})<< "Failure setting doppler_step.";
|
||||
{
|
||||
acquisition->set_doppler_step(250);
|
||||
})
|
||||
<< "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
acquisition->connect(top_block);
|
||||
})<< "Failure connecting acquisition to the top_block.";
|
||||
{
|
||||
acquisition->connect(top_block);
|
||||
})
|
||||
<< "Failure connecting acquisition to the top_block.";
|
||||
|
||||
// uncomment the next line to load the file from the current directory
|
||||
std::string file = "./GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||
@@ -332,38 +340,39 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults)
|
||||
//std::string path = std::string(TEST_PATH);
|
||||
//std::string file = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||
|
||||
const char * file_name = file.c_str();
|
||||
const char *file_name = file.c_str();
|
||||
|
||||
ASSERT_NO_THROW(
|
||||
{
|
||||
// for the unit test use dummy blocks to make the flowgraph work and allow the acquisition message to be sent.
|
||||
// in the actual system there is a flowchart running in parallel so this is not needed
|
||||
{
|
||||
// for the unit test use dummy blocks to make the flowgraph work and allow the acquisition message to be sent.
|
||||
// in the actual system there is a flowchart running in parallel so this is not needed
|
||||
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
gr::blocks::null_sink::sptr null_sink = gr::blocks::null_sink::make(sizeof(gr_complex));
|
||||
gr::blocks::throttle::sptr throttle_block = gr::blocks::throttle::make(sizeof(gr_complex),1000);
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
gr::blocks::null_sink::sptr null_sink = gr::blocks::null_sink::make(sizeof(gr_complex));
|
||||
gr::blocks::throttle::sptr throttle_block = gr::blocks::throttle::make(sizeof(gr_complex), 1000);
|
||||
|
||||
top_block->connect(file_source, 0, throttle_block, 0);
|
||||
top_block->connect(throttle_block, 0, null_sink, 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
})<< "Failure connecting the blocks of acquisition test." ;
|
||||
top_block->connect(file_source, 0, throttle_block, 0);
|
||||
top_block->connect(throttle_block, 0, null_sink, 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
})
|
||||
<< "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first state
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first state
|
||||
acquisition->init();
|
||||
top_block->start(); // Start the top block
|
||||
top_block->start(); // Start the top block
|
||||
|
||||
// start thread that sends the DMA samples to the FPGA
|
||||
boost::thread t3
|
||||
{ thread_acquisition_send_rx_samples, top_block, file_name };
|
||||
boost::thread t3{thread_acquisition_send_rx_samples, top_block, file_name};
|
||||
|
||||
EXPECT_NO_THROW(
|
||||
{
|
||||
start = std::chrono::system_clock::now();
|
||||
acquisition->reset(); // launch the tracking process
|
||||
top_block->wait();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
})<< "Failure running the top_block.";
|
||||
{
|
||||
start = std::chrono::system_clock::now();
|
||||
acquisition->reset(); // launch the tracking process
|
||||
top_block->wait();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
})
|
||||
<< "Failure running the top_block.";
|
||||
|
||||
t3.join();
|
||||
|
||||
@@ -379,4 +388,3 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults)
|
||||
EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";
|
||||
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
||||
}
|
||||
|
||||
|
||||
+65
-64
@@ -65,9 +65,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
~GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -80,21 +81,20 @@ GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsOpenClAcquisitio
|
||||
void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -102,12 +102,13 @@ GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsOpenClAcquisitionGSo
|
||||
}
|
||||
|
||||
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx::~GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test: public ::testing::Test
|
||||
class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GpsL1CaPcpsOpenClAcquisitionGSoC2013Test()
|
||||
@@ -122,7 +123,8 @@ protected:
|
||||
}
|
||||
|
||||
~GpsL1CaPcpsOpenClAcquisitionGSoC2013Test()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void config_1();
|
||||
@@ -188,14 +190,14 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_1()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 1;
|
||||
fs_in = 4e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -242,7 +244,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_1()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||
config->set_property("Acquisition_1C.threshold", "0.8");
|
||||
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||
@@ -264,10 +266,10 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2()
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 10; // Change here the number of realizations
|
||||
num_of_realizations = 10; // Change here the number of realizations
|
||||
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
|
||||
@@ -329,7 +331,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||
config->set_property("Acquisition_1C.pfa", "0.1");
|
||||
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||
@@ -426,7 +428,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, Instantiate)
|
||||
|
||||
TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
{
|
||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
||||
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
|
||||
@@ -434,7 +436,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -443,14 +445,14 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -461,33 +463,33 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -505,34 +507,33 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ((static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,33 +545,33 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
|
||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -590,31 +591,31 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+68
-68
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <stdexcept>
|
||||
#include <glog/logging.h>
|
||||
@@ -71,9 +70,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx(); //!< Default destructor
|
||||
~GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -86,21 +86,20 @@ GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx_sptr GpsL1CaPcpsQuickSyncAcqu
|
||||
void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -109,25 +108,27 @@ GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::GpsL1CaPcpsQuickSyncAcquisit
|
||||
|
||||
|
||||
GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx::~GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test: public ::testing::Test
|
||||
class GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test()
|
||||
{
|
||||
{
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
item_size = sizeof(gr_complex);
|
||||
stop = false;
|
||||
message = 0;
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
}
|
||||
}
|
||||
|
||||
~GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void config_1();
|
||||
@@ -204,14 +205,14 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_1()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 4;
|
||||
fs_in = 8e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -257,7 +258,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_1()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||
config->set_property("Acquisition_1C.threshold", "250");
|
||||
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||
@@ -272,20 +273,20 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 4;
|
||||
fs_in = 8e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
|
||||
/*Unset this flag to eliminates data logging for the Validation of results
|
||||
probabilities test*/
|
||||
dump_test_results = false;
|
||||
|
||||
|
||||
num_of_realizations = 100;
|
||||
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
@@ -348,7 +349,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||
config->set_property("Acquisition_1C.threshold", std::to_string(FLAGS_value_threshold));
|
||||
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||
@@ -363,20 +364,20 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_3()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 4;
|
||||
fs_in = 4e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
|
||||
/*Unset this flag to eliminates data logging for the Validation of results
|
||||
probabilities test*/
|
||||
dump_test_results = true;
|
||||
|
||||
|
||||
num_of_realizations = 1;
|
||||
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
@@ -439,7 +440,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_3()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.max_dwells", "2");
|
||||
config->set_property("Acquisition_1C.threshold", "0.01");
|
||||
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||
@@ -497,7 +498,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::process_message()
|
||||
correct_estimation_counter++;
|
||||
}
|
||||
}
|
||||
else if(message == 2 && gnss_synchro.PRN == 10)
|
||||
else if (message == 2 && gnss_synchro.PRN == 10)
|
||||
{
|
||||
miss_detection_counter++;
|
||||
}
|
||||
@@ -549,7 +550,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun)
|
||||
config_1();
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -558,14 +559,14 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -577,34 +578,34 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults)
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(10000);
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(250);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(100);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -623,11 +624,11 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->reset();
|
||||
@@ -636,8 +637,8 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults)
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
@@ -671,34 +672,34 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(10000);
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(250);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(100);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -717,11 +718,11 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
//acquisition->set_local_code();
|
||||
acquisition->reset();
|
||||
@@ -730,8 +731,8 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
@@ -741,9 +742,8 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
@@ -763,22 +763,22 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -798,11 +798,11 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->reset();
|
||||
@@ -811,8 +811,8 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
@@ -824,13 +824,13 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
||||
std::cout << "Estimated probability of miss detection (satellite present) = " << Pmd << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
|
||||
if(dump_test_results)
|
||||
if (dump_test_results)
|
||||
{
|
||||
std::stringstream filenamepd;
|
||||
filenamepd.str("");
|
||||
filenamepd << "../data/test_statistics_" << gnss_synchro.System
|
||||
<< "_" << gnss_synchro.Signal << "_sat_"
|
||||
<< gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv";
|
||||
<< gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv";
|
||||
|
||||
pdpfafile.open(filenamepd.str().c_str(), std::ios::app | std::ios::out);
|
||||
pdpfafile << FLAGS_value_threshold << "," << Pd << "," << Pfa_p << "," << Pmd << std::endl;
|
||||
@@ -842,13 +842,13 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
|
||||
if(dump_test_results)
|
||||
if (dump_test_results)
|
||||
{
|
||||
std::stringstream filenamepf;
|
||||
filenamepf.str("");
|
||||
filenamepf << "../data/test_statistics_" << gnss_synchro.System
|
||||
<< "_" << gnss_synchro.Signal << "_sat_"
|
||||
<< gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv";
|
||||
<< gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv";
|
||||
|
||||
pdpfafile.open(filenamepf.str().c_str(), std::ios::app | std::ios::out);
|
||||
pdpfafile << FLAGS_value_threshold << "," << Pfa_a << std::endl;
|
||||
|
||||
+64
-64
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
@@ -67,9 +66,10 @@ private:
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
~GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -82,21 +82,20 @@ GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_sptr GpsL1CaPcpsTongAcquisitionGSo
|
||||
void GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) :
|
||||
gr::block("GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx(concurrent_queue<int>& queue) : gr::block("GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -104,12 +103,13 @@ GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx::GpsL1CaPcpsTongAcquisitionGSoC201
|
||||
}
|
||||
|
||||
GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx::~GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CaPcpsTongAcquisitionGSoC2013Test: public ::testing::Test
|
||||
class GpsL1CaPcpsTongAcquisitionGSoC2013Test : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GpsL1CaPcpsTongAcquisitionGSoC2013Test()
|
||||
@@ -188,14 +188,14 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_1()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 1;
|
||||
fs_in = 4e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 1;
|
||||
@@ -242,7 +242,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_1()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.threshold", "0.8");
|
||||
config->set_property("Acquisition_1C.tong_init_val", "1");
|
||||
config->set_property("Acquisition_1C.tong_max_val", "8");
|
||||
@@ -257,14 +257,14 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_2()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal,2,0);
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
|
||||
integration_time_ms = 1;
|
||||
fs_in = 4e6;
|
||||
|
||||
expected_delay_chips = 600;
|
||||
expected_doppler_hz = 750;
|
||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
||||
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||
max_delay_error_chips = 0.50;
|
||||
|
||||
num_of_realizations = 100;
|
||||
@@ -329,8 +329,8 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_2()
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.threshold", "0.00108"); // Pfa,a = 0.1
|
||||
std::to_string(integration_time_ms));
|
||||
config->set_property("Acquisition_1C.threshold", "0.00108"); // Pfa,a = 0.1
|
||||
config->set_property("Acquisition_1C.tong_init_val", "1");
|
||||
config->set_property("Acquisition_1C.tong_max_val", "8");
|
||||
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||
@@ -425,7 +425,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, Instantiate)
|
||||
|
||||
TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
{
|
||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
||||
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
@@ -435,7 +435,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -444,14 +444,14 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -464,33 +464,33 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -508,11 +508,11 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
@@ -520,24 +520,24 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
|
||||
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
if (message == 1)
|
||||
{
|
||||
EXPECT_EQ(static_cast<unsigned int>(1), correct_estimation_counter) << "Acquisition failure. Incorrect parameters estimation.";
|
||||
}
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
{
|
||||
EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL.";
|
||||
}
|
||||
|
||||
ch_thread.join();
|
||||
}
|
||||
@@ -552,33 +552,33 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
acquisition->init();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
boost::shared_ptr<GenSignalSource> signal_source;
|
||||
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue);
|
||||
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1);
|
||||
@@ -598,34 +598,34 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
gnss_synchro.PRN = 10; // This satellite is visible
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
gnss_synchro.PRN = 20; // This satellite is not visible
|
||||
}
|
||||
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1);
|
||||
start_queue();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
top_block->run(); // Start threads and wait
|
||||
EXPECT_NO_THROW({
|
||||
top_block->run(); // Start threads and wait
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
stop_queue();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of detection = " << Pd << std::endl;
|
||||
std::cout << "Estimated probability of false alarm (satellite present) = " << Pfa_p << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
{
|
||||
std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl;
|
||||
std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl;
|
||||
}
|
||||
ch_thread.join();
|
||||
}
|
||||
}
|
||||
|
||||
+47
-47
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <chrono>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
@@ -72,7 +71,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL2MPcpsAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
~GpsL2MPcpsAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
GpsL2MPcpsAcquisitionTest_msg_rx_sptr GpsL2MPcpsAcquisitionTest_msg_rx_make()
|
||||
@@ -83,19 +82,18 @@ GpsL2MPcpsAcquisitionTest_msg_rx_sptr GpsL2MPcpsAcquisitionTest_msg_rx_make()
|
||||
void GpsL2MPcpsAcquisitionTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast &e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GpsL2MPcpsAcquisitionTest_msg_rx::GpsL2MPcpsAcquisitionTest_msg_rx() :
|
||||
gr::block("GpsL2MPcpsAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GpsL2MPcpsAcquisitionTest_msg_rx::GpsL2MPcpsAcquisitionTest_msg_rx() : gr::block("GpsL2MPcpsAcquisitionTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL2MPcpsAcquisitionTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -103,12 +101,13 @@ GpsL2MPcpsAcquisitionTest_msg_rx::GpsL2MPcpsAcquisitionTest_msg_rx() :
|
||||
}
|
||||
|
||||
GpsL2MPcpsAcquisitionTest_msg_rx::~GpsL2MPcpsAcquisitionTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL2MPcpsAcquisitionTest: public ::testing::Test
|
||||
class GpsL2MPcpsAcquisitionTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GpsL2MPcpsAcquisitionTest()
|
||||
@@ -124,7 +123,8 @@ protected:
|
||||
}
|
||||
|
||||
~GpsL2MPcpsAcquisitionTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void plot_grid();
|
||||
@@ -147,15 +147,15 @@ void GpsL2MPcpsAcquisitionTest::init()
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "2S";
|
||||
std::memcpy(static_cast<void*>(gnss_synchro.Signal), signal.c_str(), 3); // copy string into synchro char array: 2 char + null
|
||||
gnss_synchro.Signal[2] = 0; // make sure that string length is only two characters
|
||||
std::memcpy(static_cast<void *>(gnss_synchro.Signal), signal.c_str(), 3); // copy string into synchro char array: 2 char + null
|
||||
gnss_synchro.Signal[2] = 0; // make sure that string length is only two characters
|
||||
gnss_synchro.PRN = 7;
|
||||
|
||||
nsamples = round(static_cast<double>(sampling_frequency_hz) * GPS_L2_M_PERIOD) * 2;
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_frequency_hz));
|
||||
config->set_property("Acquisition_2S.implementation", "GPS_L2_M_PCPS_Acquisition");
|
||||
config->set_property("Acquisition_2S.item_type", "gr_complex");
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
config->set_property("Acquisition_2S.dump", "true");
|
||||
}
|
||||
@@ -177,16 +177,16 @@ void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||
std::string basename = "./tmp-acq-gps2/acquisition_G_2S";
|
||||
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(floor(static_cast<double>(sampling_frequency_hz) / (GPS_L2_M_CODE_RATE_HZ / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS))));
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(floor(static_cast<double>(sampling_frequency_hz) / (GPS_L2_M_CODE_RATE_HZ / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS))));
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||
if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
|
||||
std::vector<int> *doppler = &acq_dump.doppler;
|
||||
std::vector<unsigned int> *samples = &acq_dump.samples;
|
||||
std::vector<std::vector<float> > *mag = &acq_dump.mag;
|
||||
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -196,7 +196,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||
{
|
||||
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -212,11 +212,11 @@ void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||
g1.savetops("GPS_L2CM_acq_grid");
|
||||
g1.savetopdf("GPS_L2CM_acq_grid");
|
||||
g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
}
|
||||
catch (const GnuplotException &ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string data_str = "./tmp-acq-gps2";
|
||||
if (boost::filesystem::exists(data_str))
|
||||
@@ -244,7 +244,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun)
|
||||
init();
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 1);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(sampling_frequency_hz, gr::analog::GR_SIN_WAVE, 2000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -253,14 +253,14 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun)
|
||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -270,10 +270,10 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
double expected_delay_samples = 1;//2004;
|
||||
double expected_doppler_hz = 1200;//3000;
|
||||
double expected_delay_samples = 1; //2004;
|
||||
double expected_doppler_hz = 1200; //3000;
|
||||
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
std::string data_str = "./tmp-acq-gps2";
|
||||
if (boost::filesystem::exists(data_str))
|
||||
@@ -287,64 +287,64 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 1);
|
||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_channel(1);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_threshold(0.001);
|
||||
}) << "Failure setting threshold.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_max(doppler_max);
|
||||
}) << "Failure setting doppler_max.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_doppler_step(doppler_step);
|
||||
}) << "Failure setting doppler_step.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->connect(top_block);
|
||||
}) << "Failure connecting acquisition to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
std::string path = std::string(TEST_PATH);
|
||||
//std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
|
||||
std::string file = path + "signal_samples/gps_l2c_m_prn7_5msps.dat";
|
||||
//std::string file = "/datalogger/signals/Fraunhofer/L125_III1b_210s_L2_resampled.bin";
|
||||
const char * file_name = file.c_str();
|
||||
const char *file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
//gr::blocks::interleaved_short_to_complex::sptr gr_interleaved_short_to_complex_ = gr::blocks::interleaved_short_to_complex::make();
|
||||
//gr::blocks::char_to_short::sptr gr_char_to_short_ = gr::blocks::char_to_short::make();
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
//top_block->connect(file_source, 0, gr_char_to_short_, 0);
|
||||
//top_block->connect(gr_char_to_short_, 0, gr_interleaved_short_to_complex_ , 0);
|
||||
top_block->connect(file_source, 0, valve , 0);
|
||||
top_block->connect(file_source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->init();
|
||||
}) << "Failure set_state and init acquisition test";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Acquisition process runtime duration: " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Acquisition process runtime duration: " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
|
||||
std::cout << "gnss_synchro.Acq_doppler_hz = " << gnss_synchro.Acq_doppler_hz << " Hz" << std::endl;
|
||||
std::cout << "gnss_synchro.Acq_delay_samples = " << gnss_synchro.Acq_delay_samples << " Samples" << std::endl;
|
||||
std::cout << "gnss_synchro.Acq_doppler_hz = " << gnss_synchro.Acq_doppler_hz << " Hz" << std::endl;
|
||||
std::cout << "gnss_synchro.Acq_delay_samples = " << gnss_synchro.Acq_delay_samples << " Samples" << std::endl;
|
||||
|
||||
ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
|
||||
@@ -355,7 +355,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
|
||||
EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 2/(3*integration period)";
|
||||
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
||||
|
||||
if(FLAGS_plot_acq_grid == true)
|
||||
if (FLAGS_plot_acq_grid == true)
|
||||
{
|
||||
plot_grid();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
|
||||
class DataTypeAdapter: public ::testing::Test
|
||||
class DataTypeAdapter : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
DataTypeAdapter();
|
||||
@@ -81,7 +81,8 @@ DataTypeAdapter::DataTypeAdapter()
|
||||
|
||||
|
||||
DataTypeAdapter::~DataTypeAdapter()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int DataTypeAdapter::run_ishort_to_cshort_block()
|
||||
@@ -93,7 +94,7 @@ int DataTypeAdapter::run_ishort_to_cshort_block()
|
||||
EXPECT_EQ(expected_implementation, ishort_to_cshort->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str(), std::ofstream::binary);
|
||||
for(std::vector<short>::const_iterator i = input_data_shorts.cbegin(); i != input_data_shorts.cend(); ++i)
|
||||
for (std::vector<short>::const_iterator i = input_data_shorts.cbegin(); i != input_data_shorts.cend(); ++i)
|
||||
{
|
||||
short aux = *i;
|
||||
ofs.write(reinterpret_cast<const char*>(&aux), sizeof(short));
|
||||
@@ -104,7 +105,7 @@ int DataTypeAdapter::run_ishort_to_cshort_block()
|
||||
auto file_source = gr::blocks::file_source::make(sizeof(short), file_name_input.c_str());
|
||||
auto sink = gr::blocks::file_sink::make(sizeof(lv_16sc_t), file_name_output.c_str(), false);
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
top_block->connect(file_source, 0, ishort_to_cshort->get_left_block(), 0);
|
||||
top_block->connect(ishort_to_cshort->get_right_block(), 0, sink, 0);
|
||||
top_block->run();
|
||||
@@ -122,7 +123,7 @@ int DataTypeAdapter::run_ishort_to_complex_block()
|
||||
EXPECT_EQ(expected_implementation, ishort_to_complex->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str(), std::ofstream::binary);
|
||||
for(std::vector<short>::const_iterator i = input_data_shorts.cbegin(); i != input_data_shorts.cend(); ++i)
|
||||
for (std::vector<short>::const_iterator i = input_data_shorts.cbegin(); i != input_data_shorts.cend(); ++i)
|
||||
{
|
||||
short aux = *i;
|
||||
ofs.write(reinterpret_cast<const char*>(&aux), sizeof(short));
|
||||
@@ -133,7 +134,7 @@ int DataTypeAdapter::run_ishort_to_complex_block()
|
||||
auto file_source = gr::blocks::file_source::make(sizeof(short), file_name_input.c_str());
|
||||
auto sink = gr::blocks::file_sink::make(sizeof(gr_complex), file_name_output.c_str(), false);
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
top_block->connect(file_source, 0, ishort_to_complex->get_left_block(), 0);
|
||||
top_block->connect(ishort_to_complex->get_right_block(), 0, sink, 0);
|
||||
top_block->run();
|
||||
@@ -151,7 +152,7 @@ int DataTypeAdapter::run_ibyte_to_cshort_block()
|
||||
EXPECT_EQ(expected_implementation, ibyte_to_cshort->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str());
|
||||
for(std::vector<int8_t>::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
for (std::vector<int8_t>::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
{
|
||||
ofs << *i;
|
||||
}
|
||||
@@ -161,7 +162,7 @@ int DataTypeAdapter::run_ibyte_to_cshort_block()
|
||||
auto file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name_input.c_str());
|
||||
auto sink = gr::blocks::file_sink::make(sizeof(lv_16sc_t), file_name_output.c_str(), false);
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
top_block->connect(file_source, 0, ibyte_to_cshort->get_left_block(), 0);
|
||||
top_block->connect(ibyte_to_cshort->get_right_block(), 0, sink, 0);
|
||||
top_block->run();
|
||||
@@ -178,8 +179,8 @@ int DataTypeAdapter::run_ibyte_to_complex_block()
|
||||
std::string expected_implementation = "Ibyte_To_Complex";
|
||||
EXPECT_EQ(expected_implementation, ibyte_to_complex->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str() );
|
||||
for(std::vector<int8_t>::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
std::ofstream ofs(file_name_input.c_str());
|
||||
for (std::vector<int8_t>::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
{
|
||||
ofs << *i;
|
||||
}
|
||||
@@ -189,7 +190,7 @@ int DataTypeAdapter::run_ibyte_to_complex_block()
|
||||
auto file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name_input.c_str());
|
||||
auto sink = gr::blocks::file_sink::make(sizeof(gr_complex), file_name_output.c_str(), false);
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
top_block->connect(file_source, 0, ibyte_to_complex->get_left_block(), 0);
|
||||
top_block->connect(ibyte_to_complex->get_right_block(), 0, sink, 0);
|
||||
top_block->run();
|
||||
@@ -207,7 +208,7 @@ int DataTypeAdapter::run_ibyte_to_cbyte_block()
|
||||
EXPECT_EQ(expected_implementation, ibyte_to_cbyte->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str());
|
||||
for(std::vector<int8_t>::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
for (std::vector<int8_t>::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
{
|
||||
ofs << *i;
|
||||
}
|
||||
@@ -217,7 +218,7 @@ int DataTypeAdapter::run_ibyte_to_cbyte_block()
|
||||
auto file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name_input.c_str());
|
||||
auto sink = gr::blocks::file_sink::make(sizeof(short), file_name_output.c_str(), false);
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
top_block->connect(file_source, 0, ibyte_to_cbyte->get_left_block(), 0);
|
||||
top_block->connect(ibyte_to_cbyte->get_right_block(), 0, sink, 0);
|
||||
top_block->run();
|
||||
@@ -235,7 +236,7 @@ int DataTypeAdapter::run_byte_to_short_block()
|
||||
EXPECT_EQ(expected_implementation, byte_to_short->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str());
|
||||
for(std::vector<int8_t>::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
for (std::vector<int8_t>::const_iterator i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
{
|
||||
ofs << *i;
|
||||
}
|
||||
@@ -245,7 +246,7 @@ int DataTypeAdapter::run_byte_to_short_block()
|
||||
auto file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name_input.c_str());
|
||||
auto sink = gr::blocks::file_sink::make(sizeof(int16_t), file_name_output.c_str(), false);
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
top_block->connect(file_source, 0, byte_to_short->get_left_block(), 0);
|
||||
top_block->connect(byte_to_short->get_right_block(), 0, sink, 0);
|
||||
top_block->run();
|
||||
@@ -257,22 +258,22 @@ int DataTypeAdapter::run_byte_to_short_block()
|
||||
TEST_F(DataTypeAdapter, ByteToShortValidationOfResults)
|
||||
{
|
||||
run_byte_to_short_block();
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in );
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in);
|
||||
|
||||
int16_t iSample;
|
||||
int i = 0;
|
||||
try
|
||||
{
|
||||
while(ifs.read(reinterpret_cast<char *>(&iSample), sizeof(int16_t)))
|
||||
{
|
||||
while (ifs.read(reinterpret_cast<char*>(&iSample), sizeof(int16_t)))
|
||||
{
|
||||
EXPECT_EQ(input_data_bytes.at(i), static_cast<int8_t>(iSample / 256)); // Scale down!
|
||||
EXPECT_EQ(input_data_bytes.at(i), static_cast<int8_t>(iSample / 256)); // Scale down!
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch(std::system_error& e)
|
||||
{
|
||||
}
|
||||
catch (std::system_error& e)
|
||||
{
|
||||
std::cerr << e.code().message() << std::endl;
|
||||
}
|
||||
}
|
||||
ifs.close();
|
||||
ASSERT_EQ(remove(file_name_input.c_str()), 0) << "Problem deleting temporary file";
|
||||
ASSERT_EQ(remove(file_name_output.c_str()), 0) << "Problem deleting temporary file";
|
||||
@@ -282,23 +283,23 @@ TEST_F(DataTypeAdapter, ByteToShortValidationOfResults)
|
||||
TEST_F(DataTypeAdapter, IbyteToCbyteValidationOfResults)
|
||||
{
|
||||
run_ibyte_to_cbyte_block();
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in );
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in);
|
||||
lv_8sc_t iSample;
|
||||
int i = 0;
|
||||
try
|
||||
{
|
||||
while(ifs.read(reinterpret_cast<char *>(&iSample), sizeof(lv_8sc_t)))
|
||||
{
|
||||
while (ifs.read(reinterpret_cast<char*>(&iSample), sizeof(lv_8sc_t)))
|
||||
{
|
||||
EXPECT_EQ(input_data_bytes.at(i), iSample.real());
|
||||
i++;
|
||||
EXPECT_EQ(input_data_bytes.at(i), iSample.imag());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch(std::system_error& e)
|
||||
{
|
||||
}
|
||||
catch (std::system_error& e)
|
||||
{
|
||||
std::cerr << e.code().message() << std::endl;
|
||||
}
|
||||
}
|
||||
ifs.close();
|
||||
ASSERT_EQ(remove(file_name_input.c_str()), 0) << "Problem deleting temporary file";
|
||||
ASSERT_EQ(remove(file_name_output.c_str()), 0) << "Problem deleting temporary file";
|
||||
@@ -308,23 +309,23 @@ TEST_F(DataTypeAdapter, IbyteToCbyteValidationOfResults)
|
||||
TEST_F(DataTypeAdapter, IbyteToComplexValidationOfResults)
|
||||
{
|
||||
run_ibyte_to_cbyte_block();
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in );
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in);
|
||||
gr_complex iSample;
|
||||
int i = 0;
|
||||
try
|
||||
{
|
||||
while(ifs.read(reinterpret_cast<char *>(&iSample), sizeof(gr_complex)))
|
||||
{
|
||||
while (ifs.read(reinterpret_cast<char*>(&iSample), sizeof(gr_complex)))
|
||||
{
|
||||
EXPECT_EQ(input_data_bytes.at(i), static_cast<int8_t>(iSample.real()));
|
||||
i++;
|
||||
EXPECT_EQ(input_data_bytes.at(i), static_cast<int8_t>(iSample.imag()));
|
||||
EXPECT_EQ(input_data_bytes.at(i), static_cast<int8_t>(iSample.imag()));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch(std::system_error& e)
|
||||
{
|
||||
}
|
||||
catch (std::system_error& e)
|
||||
{
|
||||
std::cerr << e.code().message() << std::endl;
|
||||
}
|
||||
}
|
||||
ifs.close();
|
||||
ASSERT_EQ(remove(file_name_input.c_str()), 0) << "Problem deleting temporary file";
|
||||
ASSERT_EQ(remove(file_name_output.c_str()), 0) << "Problem deleting temporary file";
|
||||
@@ -334,23 +335,23 @@ TEST_F(DataTypeAdapter, IbyteToComplexValidationOfResults)
|
||||
TEST_F(DataTypeAdapter, IbyteToCshortValidationOfResults)
|
||||
{
|
||||
run_ibyte_to_cshort_block();
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in );
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in);
|
||||
lv_16sc_t iSample;
|
||||
int i = 0;
|
||||
try
|
||||
{
|
||||
while(ifs.read(reinterpret_cast<char *>(&iSample), sizeof(lv_16sc_t)))
|
||||
{
|
||||
while (ifs.read(reinterpret_cast<char*>(&iSample), sizeof(lv_16sc_t)))
|
||||
{
|
||||
EXPECT_EQ(input_data_bytes.at(i), static_cast<int8_t>(iSample.real()));
|
||||
i++;
|
||||
EXPECT_EQ(input_data_bytes.at(i), static_cast<int8_t>(iSample.imag()));
|
||||
EXPECT_EQ(input_data_bytes.at(i), static_cast<int8_t>(iSample.imag()));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch(std::system_error& e)
|
||||
{
|
||||
}
|
||||
catch (std::system_error& e)
|
||||
{
|
||||
std::cerr << e.code().message() << std::endl;
|
||||
}
|
||||
}
|
||||
ifs.close();
|
||||
ASSERT_EQ(remove(file_name_input.c_str()), 0) << "Problem deleting temporary file";
|
||||
ASSERT_EQ(remove(file_name_output.c_str()), 0) << "Problem deleting temporary file";
|
||||
@@ -360,23 +361,23 @@ TEST_F(DataTypeAdapter, IbyteToCshortValidationOfResults)
|
||||
TEST_F(DataTypeAdapter, IshortToComplexValidationOfResults)
|
||||
{
|
||||
run_ishort_to_complex_block();
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in );
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in);
|
||||
gr_complex iSample;
|
||||
int i = 0;
|
||||
try
|
||||
{
|
||||
while(ifs.read(reinterpret_cast<char *>(&iSample), sizeof(gr_complex)))
|
||||
{
|
||||
while (ifs.read(reinterpret_cast<char*>(&iSample), sizeof(gr_complex)))
|
||||
{
|
||||
EXPECT_EQ(input_data_shorts.at(i), static_cast<short>(iSample.real()));
|
||||
i++;
|
||||
EXPECT_EQ(input_data_shorts.at(i), static_cast<short>(iSample.imag()));
|
||||
EXPECT_EQ(input_data_shorts.at(i), static_cast<short>(iSample.imag()));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch(std::system_error& e)
|
||||
{
|
||||
}
|
||||
catch (std::system_error& e)
|
||||
{
|
||||
std::cerr << e.code().message() << std::endl;
|
||||
}
|
||||
}
|
||||
ifs.close();
|
||||
ASSERT_EQ(remove(file_name_input.c_str()), 0) << "Problem deleting temporary file";
|
||||
ASSERT_EQ(remove(file_name_output.c_str()), 0) << "Problem deleting temporary file";
|
||||
@@ -386,23 +387,23 @@ TEST_F(DataTypeAdapter, IshortToComplexValidationOfResults)
|
||||
TEST_F(DataTypeAdapter, IshortToCshortValidationOfResults)
|
||||
{
|
||||
run_ishort_to_cshort_block();
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in );
|
||||
std::ifstream ifs(file_name_output.data(), std::ifstream::binary | std::ifstream::in);
|
||||
lv_16sc_t iSample;
|
||||
int i = 0;
|
||||
try
|
||||
{
|
||||
while(ifs.read(reinterpret_cast<char *>(&iSample), sizeof(lv_16sc_t)))
|
||||
{
|
||||
while (ifs.read(reinterpret_cast<char*>(&iSample), sizeof(lv_16sc_t)))
|
||||
{
|
||||
EXPECT_EQ(input_data_shorts.at(i), static_cast<short>(iSample.real()));
|
||||
i++;
|
||||
EXPECT_EQ(input_data_shorts.at(i), static_cast<short>(iSample.imag()));
|
||||
EXPECT_EQ(input_data_shorts.at(i), static_cast<short>(iSample.imag()));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
catch(std::system_error& e)
|
||||
{
|
||||
}
|
||||
catch (std::system_error& e)
|
||||
{
|
||||
std::cerr << e.code().message() << std::endl;
|
||||
}
|
||||
}
|
||||
ifs.close();
|
||||
ASSERT_EQ(remove(file_name_input.c_str()), 0) << "Problem deleting temporary file";
|
||||
ASSERT_EQ(remove(file_name_output.c_str()), 0) << "Problem deleting temporary file";
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "in_memory_configuration.h"
|
||||
|
||||
|
||||
|
||||
TEST(PassThroughTest, Instantiate)
|
||||
{
|
||||
std::shared_ptr<ConfigurationInterface> config = std::make_shared<InMemoryConfiguration>();
|
||||
|
||||
@@ -48,9 +48,9 @@
|
||||
#include "file_signal_source.h"
|
||||
|
||||
|
||||
DEFINE_int32(filter_test_nsamples, 1000000 , "Number of samples to filter in the tests (max: 2147483647)");
|
||||
DEFINE_int32(filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)");
|
||||
|
||||
class FirFilterTest: public ::testing::Test
|
||||
class FirFilterTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
FirFilterTest()
|
||||
@@ -60,7 +60,8 @@ protected:
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
}
|
||||
~FirFilterTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void configure_cbyte_cbyte();
|
||||
@@ -182,7 +183,7 @@ TEST_F(FirFilterTest, ConnectAndRun)
|
||||
configure_gr_complex_gr_complex();
|
||||
std::shared_ptr<FirFilter> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
boost::shared_ptr<gr::block> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -193,13 +194,13 @@ TEST_F(FirFilterTest, ConnectAndRun)
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +224,7 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex)
|
||||
config2->set_property("Test_Source.repeat", "true");
|
||||
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
@@ -235,13 +236,13 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex)
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
TEST_F(FirFilterTest, ConnectAndRunCshorts)
|
||||
@@ -264,7 +265,7 @@ TEST_F(FirFilterTest, ConnectAndRunCshorts)
|
||||
config2->set_property("Test_Source.repeat", "true");
|
||||
|
||||
item_size = sizeof(std::complex<int16_t>);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
@@ -278,17 +279,16 @@ TEST_F(FirFilterTest, ConnectAndRunCshorts)
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " std::complex<int16_t> samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " std::complex<int16_t> samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_F(FirFilterTest, ConnectAndRunCbytes)
|
||||
{
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
@@ -309,7 +309,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbytes)
|
||||
config2->set_property("Test_Source.repeat", "true");
|
||||
|
||||
item_size = sizeof(std::complex<int8_t>);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
@@ -323,13 +323,13 @@ TEST_F(FirFilterTest, ConnectAndRunCbytes)
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " std::complex<int8_t> samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " std::complex<int8_t> samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbyteGrcomplex)
|
||||
config2->set_property("Test_Source.repeat", "true");
|
||||
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
@@ -367,11 +367,11 @@ TEST_F(FirFilterTest, ConnectAndRunCbyteGrcomplex)
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
#include "file_signal_source.h"
|
||||
|
||||
|
||||
DEFINE_int32(notch_filter_lite_test_nsamples, 1000000 , "Number of samples to filter in the tests (max: 2147483647)");
|
||||
DEFINE_int32(notch_filter_lite_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)");
|
||||
|
||||
class NotchFilterLiteTest: public ::testing::Test
|
||||
class NotchFilterLiteTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
NotchFilterLiteTest()
|
||||
@@ -59,7 +59,8 @@ protected:
|
||||
nsamples = FLAGS_notch_filter_lite_test_nsamples;
|
||||
}
|
||||
~NotchFilterLiteTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void configure_gr_complex_gr_complex();
|
||||
@@ -106,7 +107,7 @@ TEST_F(NotchFilterLiteTest, ConnectAndRun)
|
||||
configure_gr_complex_gr_complex();
|
||||
std::shared_ptr<NotchFilterLite> filter = std::make_shared<NotchFilterLite>(config.get(), "InputFilter", 1, 1);
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
boost::shared_ptr<gr::block> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -116,14 +117,14 @@ TEST_F(NotchFilterLiteTest, ConnectAndRun)
|
||||
top_block->connect(valve, 0, filter->get_left_block(), 0);
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,9 +147,9 @@ TEST_F(NotchFilterLiteTest, ConnectAndRunGrcomplex)
|
||||
config2->set_property("Test_Source.repeat", "true");
|
||||
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
@@ -158,11 +159,11 @@ TEST_F(NotchFilterLiteTest, ConnectAndRunGrcomplex)
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
#include "file_signal_source.h"
|
||||
|
||||
|
||||
DEFINE_int32(notch_filter_test_nsamples, 1000000 , "Number of samples to filter in the tests (max: 2147483647)");
|
||||
DEFINE_int32(notch_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)");
|
||||
|
||||
class NotchFilterTest: public ::testing::Test
|
||||
class NotchFilterTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
NotchFilterTest()
|
||||
@@ -59,7 +59,8 @@ protected:
|
||||
nsamples = FLAGS_notch_filter_test_nsamples;
|
||||
}
|
||||
~NotchFilterTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void configure_gr_complex_gr_complex();
|
||||
@@ -106,7 +107,7 @@ TEST_F(NotchFilterTest, ConnectAndRun)
|
||||
configure_gr_complex_gr_complex();
|
||||
std::shared_ptr<NotchFilter> filter = std::make_shared<NotchFilter>(config.get(), "InputFilter", 1, 1);
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
boost::shared_ptr<gr::block> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -116,14 +117,14 @@ TEST_F(NotchFilterTest, ConnectAndRun)
|
||||
top_block->connect(valve, 0, filter->get_left_block(), 0);
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,9 +147,9 @@ TEST_F(NotchFilterTest, ConnectAndRunGrcomplex)
|
||||
config2->set_property("Test_Source.repeat", "true");
|
||||
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
@@ -158,11 +159,11 @@ TEST_F(NotchFilterTest, ConnectAndRunGrcomplex)
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
+14
-13
@@ -46,9 +46,9 @@
|
||||
#include "file_signal_source.h"
|
||||
|
||||
|
||||
DEFINE_int32(pb_filter_test_nsamples, 1000000 , "Number of samples to filter in the tests (max: 2147483647)");
|
||||
DEFINE_int32(pb_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)");
|
||||
|
||||
class PulseBlankingFilterTest: public ::testing::Test
|
||||
class PulseBlankingFilterTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
PulseBlankingFilterTest()
|
||||
@@ -59,7 +59,8 @@ protected:
|
||||
nsamples = FLAGS_pb_filter_test_nsamples;
|
||||
}
|
||||
~PulseBlankingFilterTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
void configure_gr_complex_gr_complex();
|
||||
@@ -105,7 +106,7 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRun)
|
||||
configure_gr_complex_gr_complex();
|
||||
std::shared_ptr<PulseBlankingFilter> filter = std::make_shared<PulseBlankingFilter>(config.get(), "InputFilter", 1, 1);
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
boost::shared_ptr<gr::block> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -115,14 +116,14 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRun)
|
||||
top_block->connect(valve, 0, filter->get_left_block(), 0);
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,9 +146,9 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRunGrcomplex)
|
||||
config2->set_property("Test_Source.repeat", "true");
|
||||
|
||||
item_size = sizeof(gr_complex);
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
filter->connect(top_block);
|
||||
|
||||
|
||||
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||
source->connect(top_block);
|
||||
|
||||
@@ -157,11 +158,11 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRunGrcomplex)
|
||||
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||
}) << "Failure connecting the top_block.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
@@ -38,35 +38,35 @@
|
||||
bool acquisition_dump_reader::read_binary_acq()
|
||||
{
|
||||
mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY);
|
||||
if( matfile == NULL)
|
||||
if (matfile == NULL)
|
||||
{
|
||||
std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
matvar_t* var_= Mat_VarRead(matfile, "grid");
|
||||
if( var_ == NULL)
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "grid");
|
||||
if (var_ == NULL)
|
||||
{
|
||||
std::cout << "¡¡¡Unreachable grid variable into Acquisition dump file!!!" << std::endl;
|
||||
Mat_Close(matfile);
|
||||
return false;
|
||||
}
|
||||
if(var_->rank != 2)
|
||||
if (var_->rank != 2)
|
||||
{
|
||||
std::cout << "Invalid Acquisition dump file: rank error" << std::endl;
|
||||
Mat_VarFree(var_);
|
||||
Mat_Close(matfile);
|
||||
return false;
|
||||
}
|
||||
if((var_->dims[0] != d_samples_per_code) or (var_->dims[1] != d_num_doppler_bins))
|
||||
if ((var_->dims[0] != d_samples_per_code) or (var_->dims[1] != d_num_doppler_bins))
|
||||
{
|
||||
std::cout << "Invalid Acquisition dump file: dimension matrix error" << std::endl;
|
||||
if(var_->dims[0] != d_samples_per_code) std::cout << "Expected " << d_samples_per_code << " samples per code. Obtained " << var_->dims[0] << std::endl;
|
||||
if(var_->dims[1] != d_num_doppler_bins) std::cout << "Expected " << d_num_doppler_bins << " Doppler bins. Obtained " << var_->dims[1] << std::endl;
|
||||
if (var_->dims[0] != d_samples_per_code) std::cout << "Expected " << d_samples_per_code << " samples per code. Obtained " << var_->dims[0] << std::endl;
|
||||
if (var_->dims[1] != d_num_doppler_bins) std::cout << "Expected " << d_num_doppler_bins << " Doppler bins. Obtained " << var_->dims[1] << std::endl;
|
||||
Mat_VarFree(var_);
|
||||
Mat_Close(matfile);
|
||||
return false;
|
||||
}
|
||||
if(var_->data_type != MAT_T_SINGLE)
|
||||
if (var_->data_type != MAT_T_SINGLE)
|
||||
{
|
||||
std::cout << "Invalid Acquisition dump file: data type error" << std::endl;
|
||||
Mat_VarFree(var_);
|
||||
@@ -78,9 +78,9 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
float* aux = static_cast<float*>(var_->data);
|
||||
int k = 0;
|
||||
float normalization_factor = std::pow(d_samples_per_code, 2);
|
||||
for(it1 = mag.begin(); it1 != mag.end(); it1++)
|
||||
for (it1 = mag.begin(); it1 != mag.end(); it1++)
|
||||
{
|
||||
for(it2 = it1->begin(); it2 != it1->end(); it2++)
|
||||
for (it2 = it1->begin(); it2 != it1->end(); it2++)
|
||||
{
|
||||
*it2 = static_cast<float>(std::sqrt(aux[k])) / normalization_factor;
|
||||
k++;
|
||||
@@ -93,14 +93,14 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
}
|
||||
|
||||
|
||||
acquisition_dump_reader::acquisition_dump_reader(const std::string & basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code)
|
||||
acquisition_dump_reader::acquisition_dump_reader(const std::string& basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code)
|
||||
{
|
||||
d_basename = basename;
|
||||
d_sat = sat;
|
||||
d_doppler_max = doppler_max;
|
||||
d_doppler_step = doppler_step;
|
||||
d_samples_per_code = samples_per_code;
|
||||
d_num_doppler_bins = static_cast<unsigned int>(ceil( static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step)));
|
||||
d_num_doppler_bins = static_cast<unsigned int>(ceil(static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step)));
|
||||
std::vector<std::vector<float> > mag_aux(d_num_doppler_bins, std::vector<float>(d_samples_per_code));
|
||||
mag = mag_aux;
|
||||
d_dump_filename = d_basename + "_sat_" + std::to_string(d_sat) + ".mat";
|
||||
@@ -116,4 +116,5 @@ acquisition_dump_reader::acquisition_dump_reader(const std::string & basename, u
|
||||
|
||||
|
||||
acquisition_dump_reader::~acquisition_dump_reader()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
class acquisition_dump_reader
|
||||
{
|
||||
public:
|
||||
acquisition_dump_reader(const std::string & basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code);
|
||||
acquisition_dump_reader(const std::string& basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code);
|
||||
~acquisition_dump_reader();
|
||||
bool read_binary_acq();
|
||||
|
||||
@@ -56,4 +56,4 @@ private:
|
||||
std::string d_dump_filename;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_ACQUISITION_DUMP_READER_H
|
||||
#endif // GNSS_SDR_ACQUISITION_DUMP_READER_H
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
bool observables_dump_reader::read_binary_obs()
|
||||
{
|
||||
try
|
||||
{
|
||||
for(int i = 0; i < n_channels; i++)
|
||||
{
|
||||
for (int i = 0; i < n_channels; i++)
|
||||
{
|
||||
d_dump_file.read(reinterpret_cast<char *>(&RX_time[i]), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_s[i]), sizeof(double));
|
||||
@@ -45,11 +45,11 @@ bool observables_dump_reader::read_binary_obs()
|
||||
d_dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&valid[i]), sizeof(double));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ long int observables_dump_reader::num_epochs()
|
||||
std::ifstream::pos_type size;
|
||||
int number_of_vars_in_epoch = n_channels * 7;
|
||||
int epoch_size_bytes = sizeof(double) * number_of_vars_in_epoch;
|
||||
std::ifstream tmpfile( d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
std::ifstream tmpfile(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
if (tmpfile.is_open())
|
||||
{
|
||||
size = tmpfile.tellg();
|
||||
@@ -93,18 +93,18 @@ bool observables_dump_reader::open_obs_file(std::string out_file)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions( std::ifstream::failbit | std::ifstream::badbit );
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Observables sum file opened, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure & e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cout << "Problem opening TLM dump Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -62,4 +62,4 @@ private:
|
||||
std::ifstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_OBSERVABLES_DUMP_READER_H
|
||||
#endif //GNSS_SDR_OBSERVABLES_DUMP_READER_H
|
||||
|
||||
@@ -34,15 +34,15 @@
|
||||
bool tlm_dump_reader::read_binary_obs()
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&Tracking_sample_counter), sizeof(unsigned long int));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&d_TOW_at_Preamble), sizeof(double));
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ long int tlm_dump_reader::num_epochs()
|
||||
std::ifstream::pos_type size;
|
||||
int number_of_vars_in_epoch = 2;
|
||||
int epoch_size_bytes = sizeof(double) * number_of_vars_in_epoch + sizeof(unsigned long int);
|
||||
std::ifstream tmpfile( d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
std::ifstream tmpfile(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
if (tmpfile.is_open())
|
||||
{
|
||||
size = tmpfile.tellg();
|
||||
@@ -86,18 +86,18 @@ bool tlm_dump_reader::open_obs_file(std::string out_file)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions( std::ifstream::failbit | std::ifstream::badbit );
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "TLM dump enabled, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure & e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cout << "Problem opening TLM dump Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -54,4 +54,4 @@ private:
|
||||
std::ifstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_TLM_DUMP_READER_H
|
||||
#endif //GNSS_SDR_TLM_DUMP_READER_H
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
bool tracking_dump_reader::read_binary_obs()
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.read(reinterpret_cast<char *>(&abs_E), sizeof(float));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&abs_P), sizeof(float));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&abs_L), sizeof(float));
|
||||
@@ -55,11 +55,11 @@ bool tracking_dump_reader::read_binary_obs()
|
||||
d_dump_file.read(reinterpret_cast<char *>(&aux1), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&aux2), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&PRN), sizeof(unsigned int));
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ long int tracking_dump_reader::num_epochs()
|
||||
int number_of_double_vars = 11;
|
||||
int number_of_float_vars = 5;
|
||||
int epoch_size_bytes = sizeof(unsigned long int) + sizeof(double) * number_of_double_vars +
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
sizeof(float) * number_of_float_vars + sizeof(unsigned int);
|
||||
std::ifstream tmpfile(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
if (tmpfile.is_open())
|
||||
{
|
||||
@@ -105,18 +105,18 @@ bool tracking_dump_reader::open_obs_file(std::string out_file)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions( std::ifstream::failbit | std::ifstream::badbit );
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Tracking dump enabled, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure & e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cout << "Problem opening Tracking dump Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -85,4 +85,4 @@ private:
|
||||
std::ifstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_TRACKING_DUMP_READER_H
|
||||
#endif //GNSS_SDR_TRACKING_DUMP_READER_H
|
||||
|
||||
@@ -34,17 +34,17 @@
|
||||
bool tracking_true_obs_reader::read_binary_obs()
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_file.read(reinterpret_cast<char *>(&signal_timestamp_s), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&acc_carrier_phase_cycles), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&doppler_l1_hz), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&prn_delay_chips), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&tow), sizeof(double));
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ long int tracking_true_obs_reader::num_epochs()
|
||||
std::ifstream::pos_type size;
|
||||
int number_of_vars_in_epoch = 5;
|
||||
int epoch_size_bytes = sizeof(double) * number_of_vars_in_epoch;
|
||||
std::ifstream tmpfile( d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
std::ifstream tmpfile(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
if (tmpfile.is_open())
|
||||
{
|
||||
size = tmpfile.tellg();
|
||||
long int nepoch = size / epoch_size_bytes;
|
||||
long int nepoch = size / epoch_size_bytes;
|
||||
return nepoch;
|
||||
}
|
||||
else
|
||||
@@ -88,18 +88,18 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions( std::ifstream::failbit | std::ifstream::badbit );
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Observables dump enabled, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure & e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cout << "Problem opening Observables dump Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -56,4 +56,4 @@ private:
|
||||
std::ifstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_RACKING_TRUE_OBS_READER_H
|
||||
#endif //GNSS_SDR_RACKING_TRUE_OBS_READER_H
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
bool true_observables_reader::read_binary_obs()
|
||||
{
|
||||
try
|
||||
{
|
||||
for(int i = 0; i < 12; i++)
|
||||
{
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
d_dump_file.read(reinterpret_cast<char *>(&gps_time_sec[i]), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&doppler_l1_hz), sizeof(double));
|
||||
@@ -45,11 +45,11 @@ bool true_observables_reader::read_binary_obs()
|
||||
d_dump_file.read(reinterpret_cast<char *>(&carrier_phase_l1_cycles[i]), sizeof(double));
|
||||
d_dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(double));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ bool true_observables_reader::restart()
|
||||
long int true_observables_reader::num_epochs()
|
||||
{
|
||||
std::ifstream::pos_type size;
|
||||
int number_of_vars_in_epoch = 6*12;
|
||||
int number_of_vars_in_epoch = 6 * 12;
|
||||
int epoch_size_bytes = sizeof(double) * number_of_vars_in_epoch;
|
||||
std::ifstream tmpfile( d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
std::ifstream tmpfile(d_dump_filename.c_str(), std::ios::binary | std::ios::ate);
|
||||
if (tmpfile.is_open())
|
||||
{
|
||||
size = tmpfile.tellg();
|
||||
@@ -93,18 +93,18 @@ bool true_observables_reader::open_obs_file(std::string out_file)
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions( std::ifstream::failbit | std::ifstream::badbit );
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "True observables Log file opened: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure & e)
|
||||
{
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cout << "Problem opening True observables Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -57,4 +57,4 @@ private:
|
||||
std::ifstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif //GNSS_SDR_TRUE_OBSERVABLES_READER_H
|
||||
#endif //GNSS_SDR_TRUE_OBSERVABLES_READER_H
|
||||
|
||||
+129
-135
@@ -78,8 +78,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~HybridObservablesTest_msg_rx(); //!< Default destructor
|
||||
|
||||
~HybridObservablesTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
HybridObservablesTest_msg_rx_sptr HybridObservablesTest_msg_rx_make()
|
||||
@@ -90,19 +89,18 @@ HybridObservablesTest_msg_rx_sptr HybridObservablesTest_msg_rx_make()
|
||||
void HybridObservablesTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HybridObservablesTest_msg_rx::HybridObservablesTest_msg_rx() :
|
||||
gr::block("HybridObservablesTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
HybridObservablesTest_msg_rx::HybridObservablesTest_msg_rx() : gr::block("HybridObservablesTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&HybridObservablesTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -110,7 +108,8 @@ HybridObservablesTest_msg_rx::HybridObservablesTest_msg_rx() :
|
||||
}
|
||||
|
||||
HybridObservablesTest_msg_rx::~HybridObservablesTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
@@ -132,8 +131,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~HybridObservablesTest_tlm_msg_rx(); //!< Default destructor
|
||||
|
||||
~HybridObservablesTest_tlm_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
HybridObservablesTest_tlm_msg_rx_sptr HybridObservablesTest_tlm_msg_rx_make()
|
||||
@@ -144,19 +142,18 @@ HybridObservablesTest_tlm_msg_rx_sptr HybridObservablesTest_tlm_msg_rx_make()
|
||||
void HybridObservablesTest_tlm_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HybridObservablesTest_tlm_msg_rx::HybridObservablesTest_tlm_msg_rx() :
|
||||
gr::block("HybridObservablesTest_tlm_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
HybridObservablesTest_tlm_msg_rx::HybridObservablesTest_tlm_msg_rx() : gr::block("HybridObservablesTest_tlm_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&HybridObservablesTest_tlm_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -164,15 +161,15 @@ HybridObservablesTest_tlm_msg_rx::HybridObservablesTest_tlm_msg_rx() :
|
||||
}
|
||||
|
||||
HybridObservablesTest_tlm_msg_rx::~HybridObservablesTest_tlm_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
class HybridObservablesTest: public ::testing::Test
|
||||
class HybridObservablesTest : public ::testing::Test
|
||||
{
|
||||
|
||||
public:
|
||||
std::string generator_binary;
|
||||
std::string p1;
|
||||
@@ -189,18 +186,18 @@ public:
|
||||
int configure_generator();
|
||||
int generate_signal();
|
||||
void check_results_carrier_phase(
|
||||
arma::vec & true_ch0_phase_cycles,
|
||||
arma::vec & true_ch1_phase_cycles,
|
||||
arma::vec & true_ch0_tow_s,
|
||||
arma::vec & measuded_ch0_phase_cycles,
|
||||
arma::vec & measuded_ch1_phase_cycles,
|
||||
arma::vec & measuded_ch0_RX_time_s);
|
||||
arma::vec& true_ch0_phase_cycles,
|
||||
arma::vec& true_ch1_phase_cycles,
|
||||
arma::vec& true_ch0_tow_s,
|
||||
arma::vec& measuded_ch0_phase_cycles,
|
||||
arma::vec& measuded_ch1_phase_cycles,
|
||||
arma::vec& measuded_ch0_RX_time_s);
|
||||
void check_results_code_psudorange(
|
||||
arma::vec & true_ch0_dist_m, arma::vec & true_ch1_dist_m,
|
||||
arma::vec & true_ch0_tow_s,
|
||||
arma::vec & measuded_ch0_Pseudorange_m,
|
||||
arma::vec & measuded_ch1_Pseudorange_m,
|
||||
arma::vec & measuded_ch0_RX_time_s);
|
||||
arma::vec& true_ch0_dist_m, arma::vec& true_ch1_dist_m,
|
||||
arma::vec& true_ch0_tow_s,
|
||||
arma::vec& measuded_ch0_Pseudorange_m,
|
||||
arma::vec& measuded_ch1_Pseudorange_m,
|
||||
arma::vec& measuded_ch0_RX_time_s);
|
||||
|
||||
HybridObservablesTest()
|
||||
{
|
||||
@@ -212,7 +209,8 @@ public:
|
||||
}
|
||||
|
||||
~HybridObservablesTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void configure_receiver();
|
||||
|
||||
@@ -230,7 +228,7 @@ int HybridObservablesTest::configure_generator()
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if(FLAGS_dynamic_position.empty())
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(FLAGS_duration * 10);
|
||||
}
|
||||
@@ -238,9 +236,9 @@ int HybridObservablesTest::configure_generator()
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -249,7 +247,7 @@ int HybridObservablesTest::generate_signal()
|
||||
{
|
||||
int child_status;
|
||||
|
||||
char *const parmList[] = { &generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL };
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
@@ -263,7 +261,7 @@ int HybridObservablesTest::generate_signal()
|
||||
|
||||
waitpid(pid, &child_status, 0);
|
||||
|
||||
std::cout << "Signal and Observables RINEX and RAW files created." << std::endl;
|
||||
std::cout << "Signal and Observables RINEX and RAW files created." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -293,19 +291,17 @@ void HybridObservablesTest::configure_receiver()
|
||||
config->set_property("Tracking_1C.dll_bw_hz", "0.5");
|
||||
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
||||
|
||||
config->set_property("TelemetryDecoder_1C.dump","true");
|
||||
config->set_property("Observables.dump","true");
|
||||
|
||||
|
||||
config->set_property("TelemetryDecoder_1C.dump", "true");
|
||||
config->set_property("Observables.dump", "true");
|
||||
}
|
||||
|
||||
void HybridObservablesTest::check_results_carrier_phase(
|
||||
arma::vec & true_ch0_phase_cycles,
|
||||
arma::vec & true_ch1_phase_cycles,
|
||||
arma::vec & true_ch0_tow_s,
|
||||
arma::vec & measuded_ch0_phase_cycles,
|
||||
arma::vec & measuded_ch1_phase_cycles,
|
||||
arma::vec & measuded_ch0_RX_time_s)
|
||||
arma::vec& true_ch0_phase_cycles,
|
||||
arma::vec& true_ch1_phase_cycles,
|
||||
arma::vec& true_ch0_tow_s,
|
||||
arma::vec& measuded_ch0_phase_cycles,
|
||||
arma::vec& measuded_ch1_phase_cycles,
|
||||
arma::vec& measuded_ch0_RX_time_s)
|
||||
{
|
||||
//1. True value interpolation to match the measurement times
|
||||
|
||||
@@ -353,7 +349,7 @@ void HybridObservablesTest::check_results_carrier_phase(
|
||||
<< " (max,min)=" << max_error_ch0
|
||||
<< "," << min_error_ch0
|
||||
<< " [cycles]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
|
||||
ASSERT_LT(rmse_ch0, 1e-2);
|
||||
ASSERT_LT(error_mean_ch0, 1e-2);
|
||||
@@ -370,7 +366,7 @@ void HybridObservablesTest::check_results_carrier_phase(
|
||||
<< " (max,min)=" << max_error_ch1
|
||||
<< "," << min_error_ch1
|
||||
<< " [cycles]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
|
||||
ASSERT_LT(rmse_ch1, 1e-2);
|
||||
ASSERT_LT(error_mean_ch1, 1e-2);
|
||||
@@ -382,12 +378,12 @@ void HybridObservablesTest::check_results_carrier_phase(
|
||||
|
||||
|
||||
void HybridObservablesTest::check_results_code_psudorange(
|
||||
arma::vec & true_ch0_dist_m,
|
||||
arma::vec & true_ch1_dist_m,
|
||||
arma::vec & true_ch0_tow_s,
|
||||
arma::vec & measuded_ch0_Pseudorange_m,
|
||||
arma::vec & measuded_ch1_Pseudorange_m,
|
||||
arma::vec & measuded_ch0_RX_time_s)
|
||||
arma::vec& true_ch0_dist_m,
|
||||
arma::vec& true_ch1_dist_m,
|
||||
arma::vec& true_ch0_tow_s,
|
||||
arma::vec& measuded_ch0_Pseudorange_m,
|
||||
arma::vec& measuded_ch1_Pseudorange_m,
|
||||
arma::vec& measuded_ch0_RX_time_s)
|
||||
{
|
||||
//1. True value interpolation to match the measurement times
|
||||
|
||||
@@ -397,8 +393,8 @@ void HybridObservablesTest::check_results_code_psudorange(
|
||||
arma::interp1(true_ch0_tow_s, true_ch1_dist_m, measuded_ch0_RX_time_s, true_ch1_dist_interp);
|
||||
|
||||
// generate delta pseudoranges
|
||||
arma::vec delta_true_dist_m = true_ch0_dist_interp-true_ch1_dist_interp;
|
||||
arma::vec delta_measured_dist_m = measuded_ch0_Pseudorange_m-measuded_ch1_Pseudorange_m;
|
||||
arma::vec delta_true_dist_m = true_ch0_dist_interp - true_ch1_dist_interp;
|
||||
arma::vec delta_measured_dist_m = measuded_ch0_Pseudorange_m - measuded_ch1_Pseudorange_m;
|
||||
|
||||
//2. RMSE
|
||||
arma::vec err;
|
||||
@@ -423,7 +419,7 @@ void HybridObservablesTest::check_results_code_psudorange(
|
||||
<< " (max,min)=" << max_error
|
||||
<< "," << min_error
|
||||
<< " [meters]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
|
||||
ASSERT_LT(rmse, 0.5);
|
||||
ASSERT_LT(error_mean, 0.5);
|
||||
@@ -440,7 +436,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
configure_generator();
|
||||
|
||||
// Generate signal raw signal samples and observations RINEX file
|
||||
if (FLAGS_disable_generator==false)
|
||||
if (FLAGS_disable_generator == false)
|
||||
{
|
||||
generate_signal();
|
||||
}
|
||||
@@ -455,7 +451,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
tracking_true_obs_reader true_obs_data_ch1;
|
||||
int test_satellite_PRN = FLAGS_test_satellite_PRN;
|
||||
int test_satellite_PRN2 = FLAGS_test_satellite_PRN2;
|
||||
std::cout << "Testing satellite PRNs " << test_satellite_PRN <<","<<test_satellite_PRN << std::endl;
|
||||
std::cout << "Testing satellite PRNs " << test_satellite_PRN << "," << test_satellite_PRN << std::endl;
|
||||
std::string true_obs_file = std::string("./gps_l1_ca_obs_prn");
|
||||
true_obs_file.append(std::to_string(test_satellite_PRN));
|
||||
true_obs_file.append(".dat");
|
||||
@@ -488,16 +484,16 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
// load acquisition data based on the first epoch of the true observations
|
||||
ASSERT_NO_THROW({
|
||||
if (true_obs_data_ch0.read_binary_obs() == false)
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
}) << "Failure reading true observables file";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
if (true_obs_data_ch1.read_binary_obs() == false)
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
}) << "Failure reading true observables file";
|
||||
|
||||
//restart the epoch counter
|
||||
@@ -517,43 +513,43 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
gnss_synchro_ch1.Acq_samplestamp_samples = 0;
|
||||
|
||||
//telemetry decoders
|
||||
std::shared_ptr<TelemetryDecoderInterface> tlm_ch0(new GpsL1CaTelemetryDecoder(config.get(), "TelemetryDecoder_1C",1, 1));
|
||||
std::shared_ptr<TelemetryDecoderInterface> tlm_ch1(new GpsL1CaTelemetryDecoder(config.get(), "TelemetryDecoder_1C",1, 1));
|
||||
std::shared_ptr<TelemetryDecoderInterface> tlm_ch0(new GpsL1CaTelemetryDecoder(config.get(), "TelemetryDecoder_1C", 1, 1));
|
||||
std::shared_ptr<TelemetryDecoderInterface> tlm_ch1(new GpsL1CaTelemetryDecoder(config.get(), "TelemetryDecoder_1C", 1, 1));
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tlm_ch0->set_channel(0);
|
||||
tlm_ch1->set_channel(1);
|
||||
|
||||
tlm_ch0->set_satellite(Gnss_Satellite(std::string("GPS"),gnss_synchro_ch0.PRN));
|
||||
tlm_ch1->set_satellite(Gnss_Satellite(std::string("GPS"),gnss_synchro_ch1.PRN));
|
||||
tlm_ch0->set_satellite(Gnss_Satellite(std::string("GPS"), gnss_synchro_ch0.PRN));
|
||||
tlm_ch1->set_satellite(Gnss_Satellite(std::string("GPS"), gnss_synchro_ch1.PRN));
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
boost::shared_ptr<HybridObservablesTest_tlm_msg_rx> tlm_msg_rx_ch1 = HybridObservablesTest_tlm_msg_rx_make();
|
||||
boost::shared_ptr<HybridObservablesTest_tlm_msg_rx> tlm_msg_rx_ch2 = HybridObservablesTest_tlm_msg_rx_make();
|
||||
|
||||
//Observables
|
||||
std::shared_ptr<ObservablesInterface> observables(new HybridObservables(config.get(), "Observables",2, 2));
|
||||
std::shared_ptr<ObservablesInterface> observables(new HybridObservables(config.get(), "Observables", 2, 2));
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking_ch0->set_channel(gnss_synchro_ch0.Channel_ID);
|
||||
tracking_ch1->set_channel(gnss_synchro_ch1.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking_ch0->set_gnss_synchro(&gnss_synchro_ch0);
|
||||
tracking_ch1->set_gnss_synchro(&gnss_synchro_ch1);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking_ch0->connect(top_block);
|
||||
tracking_ch1->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
std::string file = "./" + filename_raw_data;
|
||||
const char * file_name = file.c_str();
|
||||
ASSERT_NO_THROW({
|
||||
std::string file = "./" + filename_raw_data;
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false);
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::null_sink::sptr sink_ch0 = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
gr::blocks::null_sink::sptr sink_ch1 = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||
@@ -570,15 +566,14 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
|
||||
top_block->connect(observables->get_right_block(), 0, sink_ch0, 0);
|
||||
top_block->connect(observables->get_right_block(), 1, sink_ch1, 0);
|
||||
|
||||
}) << "Failure connecting the blocks.";
|
||||
|
||||
tracking_ch0->start_tracking();
|
||||
tracking_ch1->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
@@ -589,7 +584,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
true_observables_reader true_observables;
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
if ( true_observables.open_obs_file(std::string("./obs_out.bin")) == false)
|
||||
if (true_observables.open_obs_file(std::string("./obs_out.bin")) == false)
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
@@ -610,34 +605,34 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
true_observables.restart();
|
||||
long int epoch_counter = 0;
|
||||
ASSERT_NO_THROW({
|
||||
while(true_observables.read_binary_obs())
|
||||
{
|
||||
if (round(true_observables.prn[0])!=gnss_synchro_ch0.PRN)
|
||||
{
|
||||
std::cout<<"True observables SV PRN do not match"<<round(true_observables.prn[1])<<std::endl;
|
||||
throw std::exception();
|
||||
}
|
||||
if (round(true_observables.prn[1])!=gnss_synchro_ch1.PRN)
|
||||
{
|
||||
std::cout<<"True observables SV PRN do not match "<<round(true_observables.prn[1])<<std::endl;
|
||||
throw std::exception();
|
||||
}
|
||||
true_ch0_tow_s(epoch_counter) = true_observables.gps_time_sec[0];
|
||||
true_ch0_dist_m(epoch_counter) = true_observables.dist_m[0];
|
||||
true_ch0_Doppler_Hz(epoch_counter) = true_observables.doppler_l1_hz[0];
|
||||
true_ch0_acc_carrier_phase_cycles(epoch_counter) = true_observables.acc_carrier_phase_l1_cycles[0];
|
||||
while (true_observables.read_binary_obs())
|
||||
{
|
||||
if (round(true_observables.prn[0]) != gnss_synchro_ch0.PRN)
|
||||
{
|
||||
std::cout << "True observables SV PRN do not match" << round(true_observables.prn[1]) << std::endl;
|
||||
throw std::exception();
|
||||
}
|
||||
if (round(true_observables.prn[1]) != gnss_synchro_ch1.PRN)
|
||||
{
|
||||
std::cout << "True observables SV PRN do not match " << round(true_observables.prn[1]) << std::endl;
|
||||
throw std::exception();
|
||||
}
|
||||
true_ch0_tow_s(epoch_counter) = true_observables.gps_time_sec[0];
|
||||
true_ch0_dist_m(epoch_counter) = true_observables.dist_m[0];
|
||||
true_ch0_Doppler_Hz(epoch_counter) = true_observables.doppler_l1_hz[0];
|
||||
true_ch0_acc_carrier_phase_cycles(epoch_counter) = true_observables.acc_carrier_phase_l1_cycles[0];
|
||||
|
||||
true_ch1_tow_s(epoch_counter) = true_observables.gps_time_sec[1];
|
||||
true_ch1_dist_m(epoch_counter) = true_observables.dist_m[1];
|
||||
true_ch1_Doppler_Hz(epoch_counter) = true_observables.doppler_l1_hz[1];
|
||||
true_ch1_acc_carrier_phase_cycles(epoch_counter) = true_observables.acc_carrier_phase_l1_cycles[1];
|
||||
true_ch1_tow_s(epoch_counter) = true_observables.gps_time_sec[1];
|
||||
true_ch1_dist_m(epoch_counter) = true_observables.dist_m[1];
|
||||
true_ch1_Doppler_Hz(epoch_counter) = true_observables.doppler_l1_hz[1];
|
||||
true_ch1_acc_carrier_phase_cycles(epoch_counter) = true_observables.acc_carrier_phase_l1_cycles[1];
|
||||
|
||||
epoch_counter++;
|
||||
}
|
||||
epoch_counter++;
|
||||
}
|
||||
});
|
||||
|
||||
//read measured values
|
||||
observables_dump_reader estimated_observables(2); //two channels
|
||||
observables_dump_reader estimated_observables(2); //two channels
|
||||
ASSERT_NO_THROW({
|
||||
if (estimated_observables.open_obs_file(std::string("./observables.dat")) == false)
|
||||
{
|
||||
@@ -663,22 +658,22 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
estimated_observables.restart();
|
||||
|
||||
epoch_counter = 0;
|
||||
while(estimated_observables.read_binary_obs())
|
||||
{
|
||||
measuded_ch0_RX_time_s(epoch_counter) = estimated_observables.RX_time[0];
|
||||
measuded_ch0_TOW_at_current_symbol_s(epoch_counter) =estimated_observables.TOW_at_current_symbol_s[0];
|
||||
measuded_ch0_Carrier_Doppler_hz(epoch_counter) = estimated_observables.Carrier_Doppler_hz[0];
|
||||
measuded_ch0_Acc_carrier_phase_hz(epoch_counter) = estimated_observables.Acc_carrier_phase_hz[0];
|
||||
measuded_ch0_Pseudorange_m(epoch_counter) = estimated_observables.Pseudorange_m[0];
|
||||
while (estimated_observables.read_binary_obs())
|
||||
{
|
||||
measuded_ch0_RX_time_s(epoch_counter) = estimated_observables.RX_time[0];
|
||||
measuded_ch0_TOW_at_current_symbol_s(epoch_counter) = estimated_observables.TOW_at_current_symbol_s[0];
|
||||
measuded_ch0_Carrier_Doppler_hz(epoch_counter) = estimated_observables.Carrier_Doppler_hz[0];
|
||||
measuded_ch0_Acc_carrier_phase_hz(epoch_counter) = estimated_observables.Acc_carrier_phase_hz[0];
|
||||
measuded_ch0_Pseudorange_m(epoch_counter) = estimated_observables.Pseudorange_m[0];
|
||||
|
||||
measuded_ch1_RX_time_s(epoch_counter) = estimated_observables.RX_time[1];
|
||||
measuded_ch1_TOW_at_current_symbol_s(epoch_counter) =estimated_observables.TOW_at_current_symbol_s[1];
|
||||
measuded_ch1_Carrier_Doppler_hz(epoch_counter) = estimated_observables.Carrier_Doppler_hz[1];
|
||||
measuded_ch1_Acc_carrier_phase_hz(epoch_counter) = estimated_observables.Acc_carrier_phase_hz[1];
|
||||
measuded_ch1_Pseudorange_m(epoch_counter) = estimated_observables.Pseudorange_m[1];
|
||||
measuded_ch1_RX_time_s(epoch_counter) = estimated_observables.RX_time[1];
|
||||
measuded_ch1_TOW_at_current_symbol_s(epoch_counter) = estimated_observables.TOW_at_current_symbol_s[1];
|
||||
measuded_ch1_Carrier_Doppler_hz(epoch_counter) = estimated_observables.Carrier_Doppler_hz[1];
|
||||
measuded_ch1_Acc_carrier_phase_hz(epoch_counter) = estimated_observables.Acc_carrier_phase_hz[1];
|
||||
measuded_ch1_Pseudorange_m(epoch_counter) = estimated_observables.Pseudorange_m[1];
|
||||
|
||||
epoch_counter++;
|
||||
}
|
||||
epoch_counter++;
|
||||
}
|
||||
|
||||
//Cut measurement initial transitory of the measurements
|
||||
arma::uvec initial_meas_point = arma::find(measuded_ch0_RX_time_s >= true_ch0_tow_s(0), 1, "first");
|
||||
@@ -697,29 +692,28 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
||||
|
||||
//find the reference satellite and compute the receiver time offset at obsevable level
|
||||
arma::vec receiver_time_offset_s;
|
||||
if (measuded_ch0_Pseudorange_m(0)<measuded_ch1_Pseudorange_m(0))
|
||||
if (measuded_ch0_Pseudorange_m(0) < measuded_ch1_Pseudorange_m(0))
|
||||
{
|
||||
receiver_time_offset_s = true_ch0_dist_m / GPS_C_m_s - GPS_STARTOFFSET_ms/1000.0;
|
||||
receiver_time_offset_s = true_ch0_dist_m / GPS_C_m_s - GPS_STARTOFFSET_ms / 1000.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
receiver_time_offset_s = true_ch1_dist_m / GPS_C_m_s - GPS_STARTOFFSET_ms/1000.0;
|
||||
receiver_time_offset_s = true_ch1_dist_m / GPS_C_m_s - GPS_STARTOFFSET_ms / 1000.0;
|
||||
}
|
||||
arma::vec corrected_reference_TOW_s = true_ch0_tow_s - receiver_time_offset_s;
|
||||
|
||||
std::cout <<" receiver_time_offset_s [0]: " << receiver_time_offset_s(0) << std::endl;
|
||||
std::cout << " receiver_time_offset_s [0]: " << receiver_time_offset_s(0) << std::endl;
|
||||
|
||||
//compare measured observables
|
||||
check_results_code_psudorange(true_ch0_dist_m, true_ch1_dist_m, corrected_reference_TOW_s,
|
||||
measuded_ch0_Pseudorange_m,measuded_ch1_Pseudorange_m, measuded_ch0_RX_time_s);
|
||||
measuded_ch0_Pseudorange_m, measuded_ch1_Pseudorange_m, measuded_ch0_RX_time_s);
|
||||
|
||||
check_results_carrier_phase(true_ch0_acc_carrier_phase_cycles,
|
||||
true_ch1_acc_carrier_phase_cycles,
|
||||
corrected_reference_TOW_s,
|
||||
measuded_ch0_Acc_carrier_phase_hz,
|
||||
measuded_ch1_Acc_carrier_phase_hz,
|
||||
measuded_ch0_RX_time_s);
|
||||
true_ch1_acc_carrier_phase_cycles,
|
||||
corrected_reference_TOW_s,
|
||||
measuded_ch0_Acc_carrier_phase_hz,
|
||||
measuded_ch1_Acc_carrier_phase_hz,
|
||||
measuded_ch0_RX_time_s);
|
||||
|
||||
std::cout << "Test completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Test completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ TEST(NmeaPrinterTest, PrintLine)
|
||||
std::shared_ptr<Pvt_Solution> pvt_solution = std::make_shared<Pvt_Solution>();
|
||||
|
||||
boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19),
|
||||
boost::posix_time::hours(22) + boost::posix_time::minutes(54) + boost::posix_time::seconds(46)); // example from http://aprs.gids.nl/nmea/#rmc
|
||||
boost::posix_time::hours(22) + boost::posix_time::minutes(54) + boost::posix_time::seconds(46)); // example from http://aprs.gids.nl/nmea/#rmc
|
||||
pvt_solution->set_position_UTC_time(pt);
|
||||
|
||||
arma::vec pos = {49.27416667, -123.18533333, 0};
|
||||
@@ -50,17 +50,17 @@ TEST(NmeaPrinterTest, PrintLine)
|
||||
|
||||
pvt_solution->set_valid_position(true);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
std::shared_ptr<Nmea_Printer> nmea_printer = std::make_shared<Nmea_Printer>(filename, false, "");
|
||||
nmea_printer->Print_Nmea_Line(pvt_solution, false);
|
||||
} ) << "Failure printing NMEA messages.";
|
||||
}) << "Failure printing NMEA messages.";
|
||||
|
||||
std::ifstream test_file(filename);
|
||||
std::string line;
|
||||
std::string GPRMC("$GPRMC");
|
||||
if(test_file.is_open())
|
||||
if (test_file.is_open())
|
||||
{
|
||||
while(getline (test_file,line))
|
||||
while (getline(test_file, line))
|
||||
{
|
||||
std::size_t found = line.find(GPRMC);
|
||||
if (found != std::string::npos)
|
||||
@@ -74,7 +74,6 @@ TEST(NmeaPrinterTest, PrintLine)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(NmeaPrinterTest, PrintLineLessthan10min)
|
||||
{
|
||||
std::string filename("nmea_test.nmea");
|
||||
@@ -82,7 +81,7 @@ TEST(NmeaPrinterTest, PrintLineLessthan10min)
|
||||
std::shared_ptr<Pvt_Solution> pvt_solution = std::make_shared<Pvt_Solution>();
|
||||
|
||||
boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19),
|
||||
boost::posix_time::hours(22) + boost::posix_time::minutes(54) + boost::posix_time::seconds(46)); // example from http://aprs.gids.nl/nmea/#rmc
|
||||
boost::posix_time::hours(22) + boost::posix_time::minutes(54) + boost::posix_time::seconds(46)); // example from http://aprs.gids.nl/nmea/#rmc
|
||||
pvt_solution->set_position_UTC_time(pt);
|
||||
|
||||
arma::vec pos = {49.07416667, -123.02527778, 0};
|
||||
@@ -90,17 +89,17 @@ TEST(NmeaPrinterTest, PrintLineLessthan10min)
|
||||
|
||||
pvt_solution->set_valid_position(true);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
std::shared_ptr<Nmea_Printer> nmea_printer = std::make_shared<Nmea_Printer>(filename, false, "");
|
||||
nmea_printer->Print_Nmea_Line(pvt_solution, false);
|
||||
} ) << "Failure printing NMEA messages.";
|
||||
}) << "Failure printing NMEA messages.";
|
||||
|
||||
std::ifstream test_file(filename);
|
||||
std::string line;
|
||||
std::string GPRMC("$GPRMC");
|
||||
if(test_file.is_open())
|
||||
if (test_file.is_open())
|
||||
{
|
||||
while(getline (test_file,line))
|
||||
while (getline(test_file, line))
|
||||
{
|
||||
std::size_t found = line.find(GPRMC);
|
||||
if (found != std::string::npos)
|
||||
|
||||
@@ -44,10 +44,10 @@ TEST(RinexPrinterTest, GalileoObsHeader)
|
||||
rp1->rinex_obs_header(rp1->obsFile, eph, 0.0);
|
||||
rp1->obsFile.seekp(0);
|
||||
|
||||
while(!rp1->obsFile.eof())
|
||||
while (!rp1->obsFile.eof())
|
||||
{
|
||||
std::getline(rp1->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
||||
{
|
||||
@@ -58,7 +58,7 @@ TEST(RinexPrinterTest, GalileoObsHeader)
|
||||
}
|
||||
std::string expected_str("E 4 C1B L1B D1B S1B SYS / # / OBS TYPES ");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
if(remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
line_aux.clear();
|
||||
|
||||
std::shared_ptr<Rinex_Printer> rp2;
|
||||
@@ -67,10 +67,10 @@ TEST(RinexPrinterTest, GalileoObsHeader)
|
||||
rp2->rinex_obs_header(rp2->obsFile, eph, 0.0, bands);
|
||||
rp2->obsFile.seekp(0);
|
||||
no_more_finds = false;
|
||||
while(!rp2->obsFile.eof())
|
||||
while (!rp2->obsFile.eof())
|
||||
{
|
||||
std::getline(rp2->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
||||
{
|
||||
@@ -82,7 +82,7 @@ TEST(RinexPrinterTest, GalileoObsHeader)
|
||||
std::string expected_str2("E 12 C1B L1B D1B S1B C5X L5X D5X S5X C7X L7X D7X S7X SYS / # / OBS TYPES ");
|
||||
EXPECT_EQ(0, expected_str2.compare(line_aux));
|
||||
|
||||
if(remove(rp2->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp2->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
@@ -99,10 +99,10 @@ TEST(RinexPrinterTest, GlonassObsHeader)
|
||||
rp1->rinex_obs_header(rp1->obsFile, eph, 0.0, bands);
|
||||
rp1->obsFile.seekp(0);
|
||||
|
||||
while(!rp1->obsFile.eof())
|
||||
while (!rp1->obsFile.eof())
|
||||
{
|
||||
std::getline(rp1->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ TEST(RinexPrinterTest, GlonassObsHeader)
|
||||
}
|
||||
std::string expected_str("R 4 C1C L1C D1C S1C SYS / # / OBS TYPES ");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
if(remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
line_aux.clear();
|
||||
}
|
||||
|
||||
@@ -133,19 +133,19 @@ TEST(RinexPrinterTest, MixedObsHeader)
|
||||
rp1->obsFile.seekp(0);
|
||||
int systems_found = 0;
|
||||
|
||||
while(!rp1->obsFile.eof())
|
||||
while (!rp1->obsFile.eof())
|
||||
{
|
||||
std::getline(rp1->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
||||
{
|
||||
systems_found++;
|
||||
if(systems_found == 1)
|
||||
if (systems_found == 1)
|
||||
{
|
||||
line_aux = std::string(line_str);
|
||||
}
|
||||
if(systems_found == 2)
|
||||
if (systems_found == 2)
|
||||
{
|
||||
line_aux2 = std::string(line_str);
|
||||
no_more_finds = true;
|
||||
@@ -158,7 +158,7 @@ TEST(RinexPrinterTest, MixedObsHeader)
|
||||
std::string expected_str2("E 8 C1B L1B D1B S1B C5X L5X D5X S5X SYS / # / OBS TYPES ");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
EXPECT_EQ(0, expected_str2.compare(line_aux2));
|
||||
if(remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
@@ -177,19 +177,19 @@ TEST(RinexPrinterTest, MixedObsHeaderGpsGlo)
|
||||
rp1->obsFile.seekp(0);
|
||||
int systems_found = 0;
|
||||
|
||||
while(!rp1->obsFile.eof())
|
||||
while (!rp1->obsFile.eof())
|
||||
{
|
||||
std::getline(rp1->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("SYS / # / OBS TYPES", 59) != std::string::npos)
|
||||
{
|
||||
systems_found++;
|
||||
if(systems_found == 1)
|
||||
if (systems_found == 1)
|
||||
{
|
||||
line_aux = std::string(line_str);
|
||||
}
|
||||
if(systems_found == 2)
|
||||
if (systems_found == 2)
|
||||
{
|
||||
line_aux2 = std::string(line_str);
|
||||
no_more_finds = true;
|
||||
@@ -202,7 +202,7 @@ TEST(RinexPrinterTest, MixedObsHeaderGpsGlo)
|
||||
std::string expected_str2("R 4 C1C L1C D1C S1C SYS / # / OBS TYPES ");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
EXPECT_EQ(0, expected_str2.compare(line_aux2));
|
||||
if(remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp1->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ TEST(RinexPrinterTest, GalileoObsLog)
|
||||
rp = std::make_shared<Rinex_Printer>();
|
||||
rp->rinex_obs_header(rp->obsFile, eph, 0.0);
|
||||
|
||||
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
|
||||
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
||||
|
||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||
Gnss_Synchro gs2 = Gnss_Synchro();
|
||||
@@ -246,18 +246,18 @@ TEST(RinexPrinterTest, GalileoObsLog)
|
||||
gs4.Carrier_Doppler_hz = 1534;
|
||||
gs4.CN0_dB_hz = 42;
|
||||
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(1,gs1) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(2,gs2) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(3,gs3) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(4,gs4) );
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(1, gs1));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(2, gs2));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(3, gs3));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(4, gs4));
|
||||
|
||||
rp->log_rinex_obs(rp->obsFile, eph, 0.0, gnss_pseudoranges_map);
|
||||
rp->obsFile.seekp(0);
|
||||
|
||||
while(!rp->obsFile.eof())
|
||||
while (!rp->obsFile.eof())
|
||||
{
|
||||
std::getline(rp->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("E22", 0) != std::string::npos)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ TEST(RinexPrinterTest, GalileoObsLog)
|
||||
std::string expected_str("E22 22000000.000 7 3.724 7 1534.000 7 42.000 ");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
|
||||
if(remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ TEST(RinexPrinterTest, GlonassObsLog)
|
||||
rp = std::make_shared<Rinex_Printer>();
|
||||
rp->rinex_obs_header(rp->obsFile, eph, 0.0);
|
||||
|
||||
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
|
||||
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
||||
|
||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||
Gnss_Synchro gs2 = Gnss_Synchro();
|
||||
@@ -314,18 +314,18 @@ TEST(RinexPrinterTest, GlonassObsLog)
|
||||
gs4.Carrier_Doppler_hz = 1534;
|
||||
gs4.CN0_dB_hz = 42;
|
||||
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(1,gs1) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(2,gs2) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(3,gs3) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(4,gs4) );
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(1, gs1));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(2, gs2));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(3, gs3));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(4, gs4));
|
||||
|
||||
rp->log_rinex_obs(rp->obsFile, eph, 0.0, gnss_pseudoranges_map);
|
||||
rp->obsFile.seekp(0);
|
||||
|
||||
while(!rp->obsFile.eof())
|
||||
while (!rp->obsFile.eof())
|
||||
{
|
||||
std::getline(rp->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("R22", 0) != std::string::npos)
|
||||
{
|
||||
@@ -338,7 +338,7 @@ TEST(RinexPrinterTest, GlonassObsLog)
|
||||
std::string expected_str("R22 22000000.000 7 3.724 7 1534.000 7 42.000 ");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
|
||||
if(remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ TEST(RinexPrinterTest, GpsObsLogDualBand)
|
||||
rp = std::make_shared<Rinex_Printer>();
|
||||
rp->rinex_obs_header(rp->obsFile, eph_gps, eph_cnav, 0.0);
|
||||
|
||||
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
|
||||
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
||||
|
||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||
Gnss_Synchro gs2 = Gnss_Synchro();
|
||||
@@ -395,18 +395,18 @@ TEST(RinexPrinterTest, GpsObsLogDualBand)
|
||||
gs3.Carrier_Doppler_hz = -1534;
|
||||
gs3.CN0_dB_hz = 47;
|
||||
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(1,gs1) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(2,gs2) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(3,gs3) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(4,gs4) );
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(1, gs1));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(2, gs2));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(3, gs3));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(4, gs4));
|
||||
|
||||
rp->log_rinex_obs(rp->obsFile, eph_gps, eph_cnav, 0.0, gnss_pseudoranges_map);
|
||||
rp->obsFile.seekp(0);
|
||||
|
||||
while(!rp->obsFile.eof())
|
||||
while (!rp->obsFile.eof())
|
||||
{
|
||||
std::getline(rp->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("G08", 0) != std::string::npos)
|
||||
{
|
||||
@@ -419,8 +419,7 @@ TEST(RinexPrinterTest, GpsObsLogDualBand)
|
||||
std::string expected_str("G08 22000002.100 6 7.226 6 321.000 6 39.000 22000000.000 7 3.724 7 1534.000 7 42.000");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
|
||||
if(remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
|
||||
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
@@ -436,7 +435,7 @@ TEST(RinexPrinterTest, GalileoObsLogDualBand)
|
||||
std::string bands("1B 5X");
|
||||
rp->rinex_obs_header(rp->obsFile, eph, 0.0, bands);
|
||||
|
||||
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
|
||||
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
||||
|
||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||
Gnss_Synchro gs2 = Gnss_Synchro();
|
||||
@@ -477,18 +476,18 @@ TEST(RinexPrinterTest, GalileoObsLogDualBand)
|
||||
gs4.Carrier_Doppler_hz = 1534;
|
||||
gs4.CN0_dB_hz = 42;
|
||||
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(1,gs1) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(2,gs2) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(3,gs3) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(4,gs4) );
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(1, gs1));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(2, gs2));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(3, gs3));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(4, gs4));
|
||||
|
||||
rp->log_rinex_obs(rp->obsFile, eph, 0.0, gnss_pseudoranges_map, bands);
|
||||
rp->obsFile.seekp(0);
|
||||
|
||||
while(!rp->obsFile.eof())
|
||||
while (!rp->obsFile.eof())
|
||||
{
|
||||
std::getline(rp->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("E08", 0) != std::string::npos)
|
||||
{
|
||||
@@ -501,11 +500,10 @@ TEST(RinexPrinterTest, GalileoObsLogDualBand)
|
||||
std::string expected_str("E08 22000002.100 6 7.226 6 321.000 6 39.000 22000000.000 7 3.724 7 1534.000 7 42.000");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
|
||||
if(remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(RinexPrinterTest, MixedObsLog)
|
||||
{
|
||||
std::string line_aux;
|
||||
@@ -518,7 +516,7 @@ TEST(RinexPrinterTest, MixedObsLog)
|
||||
rp = std::make_shared<Rinex_Printer>();
|
||||
rp->rinex_obs_header(rp->obsFile, eph_gps, eph_gal, 0.0, "1B 5X");
|
||||
|
||||
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
|
||||
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
||||
|
||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||
Gnss_Synchro gs2 = Gnss_Synchro();
|
||||
@@ -584,23 +582,23 @@ TEST(RinexPrinterTest, MixedObsLog)
|
||||
gs8.Carrier_Doppler_hz = -20;
|
||||
gs8.CN0_dB_hz = 42;
|
||||
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(1,gs1) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(2,gs2) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(3,gs3) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(4,gs4) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(5,gs5) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(6,gs6) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(7,gs7) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(8,gs8) );
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(1, gs1));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(2, gs2));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(3, gs3));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(4, gs4));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(5, gs5));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(6, gs6));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(7, gs7));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(8, gs8));
|
||||
|
||||
rp->log_rinex_obs(rp->obsFile, eph_gps, eph_gal, 0.0, gnss_pseudoranges_map);
|
||||
|
||||
rp->obsFile.seekp(0);
|
||||
|
||||
while(!rp->obsFile.eof())
|
||||
while (!rp->obsFile.eof())
|
||||
{
|
||||
std::getline(rp->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("E16", 0) != std::string::npos)
|
||||
{
|
||||
@@ -612,7 +610,7 @@ TEST(RinexPrinterTest, MixedObsLog)
|
||||
std::string expected_str("E16 22000000.000 7 0.127 7 -20.000 7 42.000 22000000.000 6 8.292 6 1534.000 6 41.000");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
|
||||
if(remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
|
||||
@@ -628,7 +626,7 @@ TEST(RinexPrinterTest, MixedObsLogGpsGlo)
|
||||
rp = std::make_shared<Rinex_Printer>();
|
||||
rp->rinex_obs_header(rp->obsFile, eph_gps, eph_glo, 0.0, "1G");
|
||||
|
||||
std::map<int,Gnss_Synchro> gnss_pseudoranges_map;
|
||||
std::map<int, Gnss_Synchro> gnss_pseudoranges_map;
|
||||
|
||||
Gnss_Synchro gs1 = Gnss_Synchro();
|
||||
Gnss_Synchro gs2 = Gnss_Synchro();
|
||||
@@ -692,23 +690,23 @@ TEST(RinexPrinterTest, MixedObsLogGpsGlo)
|
||||
gs8.Carrier_Doppler_hz = -20;
|
||||
gs8.CN0_dB_hz = 42;
|
||||
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(1,gs1) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(2,gs2) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(3,gs3) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(4,gs4) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(5,gs5) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(6,gs6) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(7,gs7) );
|
||||
gnss_pseudoranges_map.insert( std::pair<int, Gnss_Synchro>(8,gs8) );
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(1, gs1));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(2, gs2));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(3, gs3));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(4, gs4));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(5, gs5));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(6, gs6));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(7, gs7));
|
||||
gnss_pseudoranges_map.insert(std::pair<int, Gnss_Synchro>(8, gs8));
|
||||
|
||||
rp->log_rinex_obs(rp->obsFile, eph_gps, eph_glo, 0.0, gnss_pseudoranges_map);
|
||||
|
||||
rp->obsFile.seekp(0);
|
||||
|
||||
while(!rp->obsFile.eof())
|
||||
while (!rp->obsFile.eof())
|
||||
{
|
||||
std::getline(rp->obsFile, line_str);
|
||||
if(!no_more_finds)
|
||||
if (!no_more_finds)
|
||||
{
|
||||
if (line_str.find("R16", 0) != std::string::npos)
|
||||
{
|
||||
@@ -721,5 +719,5 @@ TEST(RinexPrinterTest, MixedObsLogGpsGlo)
|
||||
std::string expected_str("R16 22000000.000 6 8.292 6 1534.000 6 41.000 22000000.000 7 0.127 7 -20.000 7 42.000");
|
||||
EXPECT_EQ(0, expected_str.compare(line_aux));
|
||||
|
||||
if(remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
if (remove(rp->obsfilename.c_str()) != 0) LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ TEST(RtcmPrinterTest, Run)
|
||||
/* Convert the reference message to binary data */
|
||||
std::string reference_msg_binary;
|
||||
unsigned char c[1];
|
||||
for(unsigned int i = 0; i < reference_msg.length(); i = i + 2)
|
||||
for (unsigned int i = 0; i < reference_msg.length(); i = i + 2)
|
||||
{
|
||||
unsigned long int n, n2;
|
||||
std::istringstream(reference_msg.substr(i,1)) >> std::hex >> n;
|
||||
std::istringstream(reference_msg.substr(i, 1)) >> std::hex >> n;
|
||||
std::istringstream(reference_msg.substr(i + 1, 1)) >> std::hex >> n2;
|
||||
c[0] = static_cast<unsigned char>(n * 16) + static_cast<unsigned char>(n2);
|
||||
std::string ret(c, c+1);
|
||||
c[0] = static_cast<unsigned char>(n * 16) + static_cast<unsigned char>(n2);
|
||||
std::string ret(c, c + 1);
|
||||
reference_msg_binary += ret;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,3 @@ TEST(RtcmPrinterTest, Run)
|
||||
|
||||
EXPECT_EQ(0, reference_msg_binary.compare(testing_msg));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@ TEST(RtcmTest, BinToHex)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(RtcmTest, HexToInt)
|
||||
{
|
||||
auto rtcm = std::make_shared<Rtcm>();
|
||||
@@ -114,7 +113,7 @@ TEST(RtcmTest, HexToUint)
|
||||
{
|
||||
auto rtcm = std::make_shared<Rtcm>();
|
||||
long unsigned int expected1 = 42;
|
||||
EXPECT_EQ(expected1, rtcm->hex_to_uint(rtcm->bin_to_hex("00101010")));
|
||||
EXPECT_EQ(expected1, rtcm->hex_to_uint(rtcm->bin_to_hex("00101010")));
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +160,7 @@ TEST(RtcmTest, BinToBinaryData)
|
||||
std::string bin_str("1101101011010110");
|
||||
std::string data_str = rtcm->bin_to_binary_data(bin_str);
|
||||
|
||||
std::string test_binary = data_str.substr(0,1);
|
||||
std::string test_binary = data_str.substr(0, 1);
|
||||
std::string test_bin = rtcm->binary_data_to_bin(test_binary);
|
||||
std::string test_hex = rtcm->bin_to_hex(test_bin);
|
||||
EXPECT_EQ(0, test_hex.compare("DA"));
|
||||
@@ -253,7 +252,6 @@ TEST(RtcmTest, MT1005)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(RtcmTest, MT1019)
|
||||
{
|
||||
auto rtcm = std::make_shared<Rtcm>();
|
||||
@@ -271,7 +269,7 @@ TEST(RtcmTest, MT1019)
|
||||
EXPECT_EQ(0, rtcm->read_MT1019(tx_msg, gps_eph_read));
|
||||
EXPECT_EQ(static_cast<unsigned int>(3), gps_eph_read.i_satellite_PRN);
|
||||
EXPECT_DOUBLE_EQ(4, gps_eph_read.d_IODC);
|
||||
EXPECT_DOUBLE_EQ( 2.0 * E_LSB, gps_eph_read.d_e_eccentricity);
|
||||
EXPECT_DOUBLE_EQ(2.0 * E_LSB, gps_eph_read.d_e_eccentricity);
|
||||
EXPECT_EQ(expected_true, gps_eph_read.b_fit_interval_flag);
|
||||
EXPECT_EQ(1, rtcm->read_MT1019(rtcm->bin_to_binary_data(rtcm->hex_to_bin("FFFFFFFFFFF")), gps_eph_read));
|
||||
}
|
||||
@@ -289,23 +287,23 @@ TEST(RtcmTest, MT1020)
|
||||
Glonass_Gnav_Utc_Model gnav_utc_model_read = Glonass_Gnav_Utc_Model();
|
||||
|
||||
// Perform data read and print of special values types
|
||||
gnav_ephemeris.d_P_1 = 15;
|
||||
gnav_ephemeris.d_P_1 = 15;
|
||||
// Bit distribution per fields
|
||||
gnav_ephemeris.d_t_k = 7560;
|
||||
gnav_ephemeris.d_t_k = 7560;
|
||||
// Glonass signed values
|
||||
gnav_ephemeris.d_VXn = -0.490900039672852;
|
||||
gnav_ephemeris.d_VXn = -0.490900039672852;
|
||||
// Bit distribution per fields dependant on other factors
|
||||
gnav_ephemeris.d_t_b = 8100;
|
||||
gnav_ephemeris.d_t_b = 8100;
|
||||
// Binary flag representation
|
||||
gnav_ephemeris.d_P_3 = 1;
|
||||
gnav_ephemeris.d_P_3 = 1;
|
||||
|
||||
std::string tx_msg = rtcm->print_MT1020(gnav_ephemeris, gnav_utc_model);
|
||||
|
||||
EXPECT_EQ(0, rtcm->read_MT1020(tx_msg, gnav_ephemeris_read, gnav_utc_model_read));
|
||||
EXPECT_EQ(gnav_ephemeris.d_P_1, gnav_ephemeris_read.d_P_1);
|
||||
EXPECT_TRUE(gnav_ephemeris.d_t_b - gnav_ephemeris_read.d_t_b < FLT_EPSILON);
|
||||
EXPECT_TRUE( gnav_ephemeris.d_VXn - gnav_ephemeris_read.d_VXn < FLT_EPSILON);
|
||||
EXPECT_TRUE( gnav_ephemeris.d_t_k - gnav_ephemeris.d_t_k < FLT_EPSILON);
|
||||
EXPECT_TRUE(gnav_ephemeris.d_VXn - gnav_ephemeris_read.d_VXn < FLT_EPSILON);
|
||||
EXPECT_TRUE(gnav_ephemeris.d_t_k - gnav_ephemeris.d_t_k < FLT_EPSILON);
|
||||
EXPECT_EQ(gnav_ephemeris.d_P_3, gnav_ephemeris_read.d_P_3);
|
||||
EXPECT_EQ(1, rtcm->read_MT1020(rtcm->bin_to_binary_data(rtcm->hex_to_bin("FFFFFFFFFFF")), gnav_ephemeris_read, gnav_utc_model_read));
|
||||
}
|
||||
@@ -318,7 +316,7 @@ TEST(RtcmTest, MT1029)
|
||||
unsigned int ref_id = 23;
|
||||
double obs_time = 0;
|
||||
Gps_Ephemeris gps_eph = Gps_Ephemeris();
|
||||
std::string m1029 = rtcm->bin_to_hex(rtcm->binary_data_to_bin(rtcm->print_MT1029(ref_id, gps_eph, obs_time, s_test)));
|
||||
std::string m1029 = rtcm->bin_to_hex(rtcm->binary_data_to_bin(rtcm->print_MT1029(ref_id, gps_eph, obs_time, s_test)));
|
||||
std::string encoded_text = m1029.substr(24, 60);
|
||||
std::string expected_encoded_text("5554462D3820D0BFD180D0BED0B2D0B5D180D0BAD0B02077C3B672746572");
|
||||
EXPECT_EQ(0, expected_encoded_text.compare(encoded_text));
|
||||
@@ -345,7 +343,7 @@ TEST(RtcmTest, MT1045)
|
||||
|
||||
EXPECT_EQ(0, rtcm->read_MT1045(tx_msg, gal_eph_read));
|
||||
EXPECT_EQ(expected_true, gal_eph_read.E5a_DVS);
|
||||
EXPECT_DOUBLE_EQ( 53.0 * OMEGA_dot_3_LSB, gal_eph_read.OMEGA_dot_3);
|
||||
EXPECT_DOUBLE_EQ(53.0 * OMEGA_dot_3_LSB, gal_eph_read.OMEGA_dot_3);
|
||||
EXPECT_EQ(static_cast<unsigned int>(5), gal_eph_read.i_satellite_PRN);
|
||||
EXPECT_EQ(1, rtcm->read_MT1045(rtcm->bin_to_binary_data(rtcm->hex_to_bin("FFFFFFFFFFF")), gal_eph_read));
|
||||
}
|
||||
@@ -422,24 +420,24 @@ TEST(RtcmTest, MSMCell)
|
||||
//glo_gnav_eph.i_satellite_PRN = gnss_synchro.PRN;
|
||||
|
||||
std::string MSM1 = rtcm->print_MSM_1(gps_eph,
|
||||
{},
|
||||
gal_eph,
|
||||
{},
|
||||
obs_time,
|
||||
pseudoranges,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
{},
|
||||
gal_eph,
|
||||
{},
|
||||
obs_time,
|
||||
pseudoranges,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
|
||||
std::string MSM1_bin = rtcm->binary_data_to_bin(MSM1);
|
||||
unsigned int Nsat = 4;
|
||||
unsigned int Nsig = 3;
|
||||
unsigned int size_header = 14;
|
||||
unsigned int size_msg_length = 10;
|
||||
EXPECT_EQ(0, MSM1_bin.substr(size_header + size_msg_length + 169, Nsat * Nsig).compare("001010101100")); // check cell mask
|
||||
EXPECT_EQ(0, MSM1_bin.substr(size_header + size_msg_length + 169, Nsat * Nsig).compare("001010101100")); // check cell mask
|
||||
|
||||
std::map<int, Gnss_Synchro> pseudoranges2;
|
||||
pseudoranges2.insert(std::pair<int, Gnss_Synchro>(1, gnss_synchro6));
|
||||
@@ -450,19 +448,19 @@ TEST(RtcmTest, MSMCell)
|
||||
pseudoranges2.insert(std::pair<int, Gnss_Synchro>(5, gnss_synchro));
|
||||
pseudoranges2.insert(std::pair<int, Gnss_Synchro>(6, gnss_synchro));
|
||||
std::string MSM1_2 = rtcm->print_MSM_1(gps_eph,
|
||||
{},
|
||||
gal_eph,
|
||||
{},
|
||||
obs_time,
|
||||
pseudoranges2,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
{},
|
||||
gal_eph,
|
||||
{},
|
||||
obs_time,
|
||||
pseudoranges2,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
std::string MSM1_bin_2 = rtcm->binary_data_to_bin(MSM1_2);
|
||||
EXPECT_EQ(0, MSM1_bin_2.substr(size_header + size_msg_length + 169, Nsat * Nsig).compare("001010001100")); // check cell mask
|
||||
EXPECT_EQ(0, MSM1_bin_2.substr(size_header + size_msg_length + 169, Nsat * Nsig).compare("001010001100")); // check cell mask
|
||||
|
||||
Gnss_Synchro gnss_synchro7;
|
||||
gnss_synchro7.PRN = 10;
|
||||
@@ -478,19 +476,19 @@ TEST(RtcmTest, MSMCell)
|
||||
pseudoranges3.insert(std::pair<int, Gnss_Synchro>(5, gnss_synchro5));
|
||||
|
||||
std::string MSM1_3 = rtcm->print_MSM_1(gps_eph,
|
||||
{},
|
||||
gal_eph,
|
||||
{},
|
||||
obs_time,
|
||||
pseudoranges3,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
{},
|
||||
gal_eph,
|
||||
{},
|
||||
obs_time,
|
||||
pseudoranges3,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
std::string MSM1_bin_3 = rtcm->binary_data_to_bin(MSM1_3);
|
||||
EXPECT_EQ(0, MSM1_bin_3.substr(size_header + size_msg_length + 169, (Nsat-1) * Nsig).compare("001010111")); // check cell mask
|
||||
EXPECT_EQ(0, MSM1_bin_3.substr(size_header + size_msg_length + 169, (Nsat - 1) * Nsig).compare("001010111")); // check cell mask
|
||||
}
|
||||
|
||||
|
||||
@@ -547,15 +545,15 @@ TEST(RtcmTest, MSM1)
|
||||
gps_eph.i_satellite_PRN = gnss_synchro.PRN;
|
||||
|
||||
std::string MSM1 = rtcm->print_MSM_1(gps_eph,
|
||||
{}, {}, {},
|
||||
obs_time,
|
||||
pseudoranges,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
{}, {}, {},
|
||||
obs_time,
|
||||
pseudoranges,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
|
||||
EXPECT_EQ(expected_true, rtcm->check_CRC(MSM1));
|
||||
|
||||
@@ -569,23 +567,23 @@ TEST(RtcmTest, MSM1)
|
||||
unsigned int data_size = MSM1_bin.length() - size_header - size_msg_length - size_crc;
|
||||
EXPECT_EQ(expected_true, upper_bound >= data_size);
|
||||
EXPECT_EQ(0, MSM1_bin.substr(0, size_header).compare("11010011000000"));
|
||||
EXPECT_EQ(ref_id, rtcm->bin_to_uint( MSM1_bin.substr(size_header + size_msg_length + 12, 12)));
|
||||
EXPECT_EQ(0, MSM1_bin.substr(size_header + size_msg_length + 169, Nsat * Nsig).compare("101101")); // check cell mask
|
||||
EXPECT_EQ(ref_id, rtcm->bin_to_uint(MSM1_bin.substr(size_header + size_msg_length + 12, 12)));
|
||||
EXPECT_EQ(0, MSM1_bin.substr(size_header + size_msg_length + 169, Nsat * Nsig).compare("101101")); // check cell mask
|
||||
|
||||
double meters_to_miliseconds = GPS_C_m_s * 0.001;
|
||||
unsigned int rough_range_1 = static_cast<unsigned int>(std::floor(std::round(gnss_synchro.Pseudorange_m / meters_to_miliseconds / TWO_N10)) + 0.5) & 0x3FFu;
|
||||
unsigned int rough_range_2 = static_cast<unsigned int>(std::floor(std::round(gnss_synchro2.Pseudorange_m / meters_to_miliseconds / TWO_N10)) + 0.5) & 0x3FFu;
|
||||
unsigned int rough_range_4 = static_cast<unsigned int>(std::floor(std::round(gnss_synchro3.Pseudorange_m / meters_to_miliseconds / TWO_N10)) + 0.5) & 0x3FFu;
|
||||
unsigned int read_pseudorange_1 = rtcm->bin_to_uint( MSM1_bin.substr(size_header + size_msg_length + 169 + Nsat * Nsig , 10));
|
||||
unsigned int read_pseudorange_2 = rtcm->bin_to_uint( MSM1_bin.substr(size_header + size_msg_length + 169 + Nsat * Nsig + 10, 10));
|
||||
unsigned int read_pseudorange_4 = rtcm->bin_to_uint( MSM1_bin.substr(size_header + size_msg_length + 169 + Nsat * Nsig + 20, 10));
|
||||
unsigned int read_pseudorange_1 = rtcm->bin_to_uint(MSM1_bin.substr(size_header + size_msg_length + 169 + Nsat * Nsig, 10));
|
||||
unsigned int read_pseudorange_2 = rtcm->bin_to_uint(MSM1_bin.substr(size_header + size_msg_length + 169 + Nsat * Nsig + 10, 10));
|
||||
unsigned int read_pseudorange_4 = rtcm->bin_to_uint(MSM1_bin.substr(size_header + size_msg_length + 169 + Nsat * Nsig + 20, 10));
|
||||
|
||||
EXPECT_EQ(rough_range_1, read_pseudorange_1);
|
||||
EXPECT_EQ(rough_range_2, read_pseudorange_2);
|
||||
EXPECT_EQ(rough_range_4, read_pseudorange_4);
|
||||
|
||||
int psrng4_s = static_cast<int>(std::round( (gnss_synchro3.Pseudorange_m - std::round(gnss_synchro3.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10)/ meters_to_miliseconds / TWO_N24));
|
||||
int read_psrng4_s = rtcm->bin_to_int( MSM1_bin.substr(size_header + size_msg_length + 169 + (Nsat * Nsig) + 30 + 15 * 3, 15));
|
||||
int psrng4_s = static_cast<int>(std::round((gnss_synchro3.Pseudorange_m - std::round(gnss_synchro3.Pseudorange_m / meters_to_miliseconds / TWO_N10) * meters_to_miliseconds * TWO_N10) / meters_to_miliseconds / TWO_N24));
|
||||
int read_psrng4_s = rtcm->bin_to_int(MSM1_bin.substr(size_header + size_msg_length + 169 + (Nsat * Nsig) + 30 + 15 * 3, 15));
|
||||
EXPECT_EQ(psrng4_s, read_psrng4_s);
|
||||
|
||||
std::map<int, Gnss_Synchro> pseudoranges2;
|
||||
@@ -594,17 +592,17 @@ TEST(RtcmTest, MSM1)
|
||||
pseudoranges2.insert(std::pair<int, Gnss_Synchro>(3, gnss_synchro2));
|
||||
pseudoranges2.insert(std::pair<int, Gnss_Synchro>(4, gnss_synchro));
|
||||
std::string MSM1_2 = rtcm->print_MSM_1(gps_eph,
|
||||
{}, {}, {},
|
||||
obs_time,
|
||||
pseudoranges2,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
{}, {}, {},
|
||||
obs_time,
|
||||
pseudoranges2,
|
||||
ref_id,
|
||||
clock_steering_indicator,
|
||||
external_clock_indicator,
|
||||
smooth_int,
|
||||
divergence_free,
|
||||
more_messages);
|
||||
std::string MSM1_bin2 = rtcm->binary_data_to_bin(MSM1_2);
|
||||
int read_psrng4_s_2 = rtcm->bin_to_int( MSM1_bin2.substr(size_header + size_msg_length + 169 + (Nsat * Nsig) + 30 + 15 * 3, 15));
|
||||
int read_psrng4_s_2 = rtcm->bin_to_int(MSM1_bin2.substr(size_header + size_msg_length + 169 + (Nsat * Nsig) + 30 + 15 * 3, 15));
|
||||
EXPECT_EQ(psrng4_s, read_psrng4_s_2);
|
||||
}
|
||||
|
||||
@@ -643,7 +641,3 @@ TEST(RtcmTest, InstantiateServerWithoutClosing)
|
||||
std::string test3_bin = rtcm->hex_to_bin(test3);
|
||||
EXPECT_EQ(0, test3_bin.compare("11111111"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+7
-7
@@ -43,11 +43,11 @@
|
||||
|
||||
TEST(DirectResamplerConditionerCcTest, InstantiationAndRunTest)
|
||||
{
|
||||
double fs_in = 8000000.0; // Input sampling frequency in Hz
|
||||
double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz
|
||||
double fs_in = 8000000.0; // Input sampling frequency in Hz
|
||||
double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
int nsamples = 1000000; //Number of samples to be computed
|
||||
int nsamples = 1000000; //Number of samples to be computed
|
||||
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||
gr::top_block_sptr top_block = gr::make_top_block("direct_resampler_conditioner_cc_test");
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||
@@ -60,19 +60,19 @@ TEST(DirectResamplerConditionerCcTest, InstantiationAndRunTest)
|
||||
direct_resampler_conditioner_cc_sptr resampler = direct_resampler_make_conditioner_cc(fs_in, fs_out);
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex));
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, resampler, 0);
|
||||
top_block->connect(resampler, 0, sink, 0);
|
||||
}) << "Connection failure of direct_resampler_conditioner.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
top_block->stop();
|
||||
}) << "Failure running direct_resampler_conditioner.";
|
||||
|
||||
std::cout << "Resampled " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Resampled " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@
|
||||
|
||||
TEST(MmseResamplerTest, InstantiationAndRunTestWarning)
|
||||
{
|
||||
double fs_in = 8000000.0; // Input sampling frequency in Hz
|
||||
double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz
|
||||
double fs_in = 8000000.0; // Input sampling frequency in Hz
|
||||
double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
int nsamples = 1000000; //Number of samples to be computed
|
||||
int nsamples = 1000000; //Number of samples to be computed
|
||||
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||
gr::top_block_sptr top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test");
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||
@@ -60,32 +60,32 @@ TEST(MmseResamplerTest, InstantiationAndRunTestWarning)
|
||||
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex));
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
resampler->connect(top_block);
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, resampler->get_left_block(), 0);
|
||||
top_block->connect(resampler->get_right_block(), 0, sink, 0);
|
||||
}) << "Connection failure of direct_resampler_conditioner.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
top_block->stop();
|
||||
}) << "Failure running direct_resampler_conditioner.";
|
||||
|
||||
std::cout << "Resampled " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Resampled " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
TEST(MmseResamplerTest, InstantiationAndRunTest2)
|
||||
{
|
||||
double fs_in = 8000000.0; // Input sampling frequency in Hz
|
||||
double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz
|
||||
double fs_in = 8000000.0; // Input sampling frequency in Hz
|
||||
double fs_out = 4000000.0; // sampling freuqncy of the resampled signal in Hz
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
int nsamples = 1000000; //Number of samples to be computed
|
||||
int nsamples = 1000000; //Number of samples to be computed
|
||||
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||
gr::top_block_sptr top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test");
|
||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||
@@ -101,21 +101,20 @@ TEST(MmseResamplerTest, InstantiationAndRunTest2)
|
||||
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(gr_complex));
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
resampler->connect(top_block);
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, resampler->get_left_block(), 0);
|
||||
top_block->connect(resampler->get_right_block(), 0, sink, 0);
|
||||
}) << "Connection failure of direct_resampler_conditioner.";
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
top_block->stop();
|
||||
}) << "Failure running direct_resampler_conditioner.";
|
||||
|
||||
std::cout << "Resampled " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Resampled " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,5 +67,5 @@ TEST(FileSignalSource, InstantiateFileNotExists)
|
||||
config->set_property("Test.item_type", "gr_complex");
|
||||
config->set_property("Test.repeat", "false");
|
||||
|
||||
EXPECT_THROW({auto uptr = std::make_shared<FileSignalSource>(config.get(), "Test", 1, 1, queue);}, std::exception);
|
||||
EXPECT_THROW({ auto uptr = std::make_shared<FileSignalSource>(config.get(), "Test", 1, 1, queue); }, std::exception);
|
||||
}
|
||||
|
||||
+110
-119
@@ -39,44 +39,41 @@
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include "unpack_2bit_samples.h"
|
||||
|
||||
std::vector< uint8_t > packData( std::vector< int8_t > const & raw_data,
|
||||
bool big_endian )
|
||||
std::vector<uint8_t> packData(std::vector<int8_t> const &raw_data,
|
||||
bool big_endian)
|
||||
{
|
||||
std::vector< uint8_t > packed_data( raw_data.size()/4 );
|
||||
std::vector<uint8_t> packed_data(raw_data.size() / 4);
|
||||
|
||||
int shift = ( big_endian ? 6 : 0 );
|
||||
int shift = (big_endian ? 6 : 0);
|
||||
unsigned int j = 0;
|
||||
|
||||
for( unsigned int i = 0; i < raw_data.size(); ++i )
|
||||
{
|
||||
unsigned val = static_cast< unsigned >( (raw_data[i] - 1 )/2 & 0x03 );
|
||||
|
||||
packed_data[j] |= val << shift;
|
||||
|
||||
if( big_endian )
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
shift -= 2;
|
||||
if( shift < 0 )
|
||||
{
|
||||
shift = 6;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shift += 2;
|
||||
if( shift > 6 )
|
||||
{
|
||||
shift = 0;
|
||||
j++;
|
||||
}
|
||||
unsigned val = static_cast<unsigned>((raw_data[i] - 1) / 2 & 0x03);
|
||||
|
||||
}
|
||||
packed_data[j] |= val << shift;
|
||||
|
||||
}
|
||||
if (big_endian)
|
||||
{
|
||||
shift -= 2;
|
||||
if (shift < 0)
|
||||
{
|
||||
shift = 6;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shift += 2;
|
||||
if (shift > 6)
|
||||
{
|
||||
shift = 0;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return packed_data;
|
||||
|
||||
}
|
||||
|
||||
TEST(Unpack2bitSamplesTest, CheckBigEndianByte)
|
||||
@@ -86,30 +83,30 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianByte)
|
||||
bool big_endian_items = false;
|
||||
|
||||
|
||||
std::vector< int8_t > raw_data = { -1, 3, 1, -1, -3, 1, 3, 1 };
|
||||
std::vector< uint8_t > packed_data = packData( raw_data, big_endian_bytes );
|
||||
std::vector< uint8_t > unpacked_data;
|
||||
std::vector<int8_t> raw_data = {-1, 3, 1, -1, -3, 1, 3, 1};
|
||||
std::vector<uint8_t> packed_data = packData(raw_data, big_endian_bytes);
|
||||
std::vector<uint8_t> unpacked_data;
|
||||
|
||||
gr::top_block_sptr top_block = gr::make_top_block("Unpack2bitSamplesTest");
|
||||
|
||||
gr::blocks::vector_source_b::sptr source =
|
||||
gr::blocks::vector_source_b::make( packed_data );
|
||||
gr::blocks::vector_source_b::make(packed_data);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> unpacker =
|
||||
make_unpack_2bit_samples(big_endian_bytes,
|
||||
item_size,
|
||||
big_endian_items );
|
||||
item_size,
|
||||
big_endian_items);
|
||||
|
||||
gr::blocks::stream_to_vector::sptr stov =
|
||||
gr::blocks::stream_to_vector::make( item_size, raw_data.size() );
|
||||
gr::blocks::stream_to_vector::make(item_size, raw_data.size());
|
||||
|
||||
gr::blocks::vector_sink_b::sptr sink =
|
||||
gr::blocks::vector_sink_b::make( raw_data.size() );
|
||||
gr::blocks::vector_sink_b::make(raw_data.size());
|
||||
|
||||
|
||||
top_block->connect(source, 0, unpacker, 0);
|
||||
top_block->connect(unpacker, 0, stov, 0 );
|
||||
top_block->connect(unpacker, 0, stov, 0);
|
||||
top_block->connect(stov, 0, sink, 0);
|
||||
|
||||
top_block->run();
|
||||
@@ -117,13 +114,12 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianByte)
|
||||
|
||||
unpacked_data = sink->data();
|
||||
|
||||
EXPECT_EQ( raw_data.size(), unpacked_data.size() );
|
||||
|
||||
for( unsigned int i = 0; i < raw_data.size(); ++i )
|
||||
{
|
||||
EXPECT_EQ( raw_data[i], static_cast< int8_t >( unpacked_data[i] ) );
|
||||
}
|
||||
EXPECT_EQ(raw_data.size(), unpacked_data.size());
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(raw_data[i], static_cast<int8_t>(unpacked_data[i]));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Unpack2bitSamplesTest, CheckLittleEndianByte)
|
||||
@@ -133,30 +129,30 @@ TEST(Unpack2bitSamplesTest, CheckLittleEndianByte)
|
||||
bool big_endian_items = false;
|
||||
|
||||
|
||||
std::vector< int8_t > raw_data = { -1, 3, 1, -1, -3, 1, 3, 1 };
|
||||
std::vector< uint8_t > packed_data = packData( raw_data, big_endian_bytes );
|
||||
std::vector< uint8_t > unpacked_data;
|
||||
std::vector<int8_t> raw_data = {-1, 3, 1, -1, -3, 1, 3, 1};
|
||||
std::vector<uint8_t> packed_data = packData(raw_data, big_endian_bytes);
|
||||
std::vector<uint8_t> unpacked_data;
|
||||
|
||||
gr::top_block_sptr top_block = gr::make_top_block("Unpack2bitSamplesTest");
|
||||
|
||||
gr::blocks::vector_source_b::sptr source =
|
||||
gr::blocks::vector_source_b::make( packed_data );
|
||||
gr::blocks::vector_source_b::make(packed_data);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> unpacker =
|
||||
make_unpack_2bit_samples(big_endian_bytes,
|
||||
item_size,
|
||||
big_endian_items );
|
||||
item_size,
|
||||
big_endian_items);
|
||||
|
||||
gr::blocks::stream_to_vector::sptr stov =
|
||||
gr::blocks::stream_to_vector::make( item_size, raw_data.size() );
|
||||
gr::blocks::stream_to_vector::make(item_size, raw_data.size());
|
||||
|
||||
gr::blocks::vector_sink_b::sptr sink =
|
||||
gr::blocks::vector_sink_b::make( raw_data.size() );
|
||||
gr::blocks::vector_sink_b::make(raw_data.size());
|
||||
|
||||
|
||||
top_block->connect(source, 0, unpacker, 0);
|
||||
top_block->connect(unpacker, 0, stov, 0 );
|
||||
top_block->connect(unpacker, 0, stov, 0);
|
||||
top_block->connect(stov, 0, sink, 0);
|
||||
|
||||
top_block->run();
|
||||
@@ -164,13 +160,12 @@ TEST(Unpack2bitSamplesTest, CheckLittleEndianByte)
|
||||
|
||||
unpacked_data = sink->data();
|
||||
|
||||
EXPECT_EQ( raw_data.size(), unpacked_data.size() );
|
||||
|
||||
for( unsigned int i = 0; i < raw_data.size(); ++i )
|
||||
{
|
||||
EXPECT_EQ( raw_data[i], static_cast< int8_t >( unpacked_data[i] ) );
|
||||
}
|
||||
EXPECT_EQ(raw_data.size(), unpacked_data.size());
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(raw_data[i], static_cast<int8_t>(unpacked_data[i]));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Unpack2bitSamplesTest, CheckBigEndianShortBigEndianByte)
|
||||
@@ -180,51 +175,50 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortBigEndianByte)
|
||||
bool big_endian_items = true;
|
||||
|
||||
|
||||
std::vector< int8_t > raw_data = { -1, 3, 1, -1, -3, 1, 3, 1 };
|
||||
std::vector< uint8_t > packed_data = packData( raw_data, big_endian_bytes );
|
||||
std::vector<int8_t> raw_data = {-1, 3, 1, -1, -3, 1, 3, 1};
|
||||
std::vector<uint8_t> packed_data = packData(raw_data, big_endian_bytes);
|
||||
// change the order of each pair of bytes:
|
||||
for( unsigned int ii = 0; ii < packed_data.size(); ii+=item_size )
|
||||
{
|
||||
unsigned int kk = ii + item_size - 1;
|
||||
unsigned int jj = ii;
|
||||
while( kk > jj )
|
||||
for (unsigned int ii = 0; ii < packed_data.size(); ii += item_size)
|
||||
{
|
||||
uint8_t tmp = packed_data[jj];
|
||||
packed_data[jj] = packed_data[kk];
|
||||
packed_data[kk] = tmp;
|
||||
--kk;
|
||||
++jj;
|
||||
unsigned int kk = ii + item_size - 1;
|
||||
unsigned int jj = ii;
|
||||
while (kk > jj)
|
||||
{
|
||||
uint8_t tmp = packed_data[jj];
|
||||
packed_data[jj] = packed_data[kk];
|
||||
packed_data[kk] = tmp;
|
||||
--kk;
|
||||
++jj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now create a new big endian buffer:
|
||||
std::vector< int16_t > packed_data_short(
|
||||
reinterpret_cast< int16_t *>( &packed_data[0] ),
|
||||
reinterpret_cast< int16_t * >( &packed_data[0] )
|
||||
+ packed_data.size()/item_size);
|
||||
std::vector<int16_t> packed_data_short(
|
||||
reinterpret_cast<int16_t *>(&packed_data[0]),
|
||||
reinterpret_cast<int16_t *>(&packed_data[0]) + packed_data.size() / item_size);
|
||||
|
||||
std::vector< uint8_t > unpacked_data;
|
||||
std::vector<uint8_t> unpacked_data;
|
||||
|
||||
gr::top_block_sptr top_block = gr::make_top_block("Unpack2bitSamplesTest");
|
||||
|
||||
gr::blocks::vector_source_s::sptr source =
|
||||
gr::blocks::vector_source_s::make( packed_data_short );
|
||||
gr::blocks::vector_source_s::make(packed_data_short);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> unpacker =
|
||||
make_unpack_2bit_samples(big_endian_bytes,
|
||||
item_size,
|
||||
big_endian_items );
|
||||
item_size,
|
||||
big_endian_items);
|
||||
|
||||
gr::blocks::stream_to_vector::sptr stov =
|
||||
gr::blocks::stream_to_vector::make( 1, raw_data.size() );
|
||||
gr::blocks::stream_to_vector::make(1, raw_data.size());
|
||||
|
||||
gr::blocks::vector_sink_b::sptr sink =
|
||||
gr::blocks::vector_sink_b::make( raw_data.size() );
|
||||
gr::blocks::vector_sink_b::make(raw_data.size());
|
||||
|
||||
|
||||
top_block->connect(source, 0, unpacker, 0);
|
||||
top_block->connect(unpacker, 0, stov, 0 );
|
||||
top_block->connect(unpacker, 0, stov, 0);
|
||||
top_block->connect(stov, 0, sink, 0);
|
||||
|
||||
top_block->run();
|
||||
@@ -232,13 +226,12 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortBigEndianByte)
|
||||
|
||||
unpacked_data = sink->data();
|
||||
|
||||
EXPECT_EQ( raw_data.size(), unpacked_data.size() );
|
||||
|
||||
for( unsigned int i = 0; i < raw_data.size(); ++i )
|
||||
{
|
||||
EXPECT_EQ( raw_data[i], static_cast< int8_t >( unpacked_data[i] ) );
|
||||
}
|
||||
EXPECT_EQ(raw_data.size(), unpacked_data.size());
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(raw_data[i], static_cast<int8_t>(unpacked_data[i]));
|
||||
}
|
||||
}
|
||||
|
||||
TEST(Unpack2bitSamplesTest, CheckBigEndianShortLittleEndianByte)
|
||||
@@ -248,51 +241,50 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortLittleEndianByte)
|
||||
bool big_endian_items = true;
|
||||
|
||||
|
||||
std::vector< int8_t > raw_data = { -1, 3, 1, -1, -3, 1, 3, 1 };
|
||||
std::vector< uint8_t > packed_data = packData( raw_data, big_endian_bytes );
|
||||
std::vector<int8_t> raw_data = {-1, 3, 1, -1, -3, 1, 3, 1};
|
||||
std::vector<uint8_t> packed_data = packData(raw_data, big_endian_bytes);
|
||||
// change the order of each pair of bytes:
|
||||
for( unsigned int ii = 0; ii < packed_data.size(); ii+=item_size )
|
||||
{
|
||||
unsigned int kk = ii + item_size - 1;
|
||||
unsigned int jj = ii;
|
||||
while( kk > jj )
|
||||
for (unsigned int ii = 0; ii < packed_data.size(); ii += item_size)
|
||||
{
|
||||
uint8_t tmp = packed_data[jj];
|
||||
packed_data[jj] = packed_data[kk];
|
||||
packed_data[kk] = tmp;
|
||||
--kk;
|
||||
++jj;
|
||||
unsigned int kk = ii + item_size - 1;
|
||||
unsigned int jj = ii;
|
||||
while (kk > jj)
|
||||
{
|
||||
uint8_t tmp = packed_data[jj];
|
||||
packed_data[jj] = packed_data[kk];
|
||||
packed_data[kk] = tmp;
|
||||
--kk;
|
||||
++jj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Now create a new big endian buffer:
|
||||
std::vector< int16_t > packed_data_short(
|
||||
reinterpret_cast< int16_t *>( &packed_data[0] ),
|
||||
reinterpret_cast< int16_t * >( &packed_data[0] )
|
||||
+ packed_data.size()/item_size);
|
||||
std::vector<int16_t> packed_data_short(
|
||||
reinterpret_cast<int16_t *>(&packed_data[0]),
|
||||
reinterpret_cast<int16_t *>(&packed_data[0]) + packed_data.size() / item_size);
|
||||
|
||||
std::vector< uint8_t > unpacked_data;
|
||||
std::vector<uint8_t> unpacked_data;
|
||||
|
||||
gr::top_block_sptr top_block = gr::make_top_block("Unpack2bitSamplesTest");
|
||||
|
||||
gr::blocks::vector_source_s::sptr source =
|
||||
gr::blocks::vector_source_s::make( packed_data_short );
|
||||
gr::blocks::vector_source_s::make(packed_data_short);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> unpacker =
|
||||
make_unpack_2bit_samples(big_endian_bytes,
|
||||
item_size,
|
||||
big_endian_items );
|
||||
item_size,
|
||||
big_endian_items);
|
||||
|
||||
gr::blocks::stream_to_vector::sptr stov =
|
||||
gr::blocks::stream_to_vector::make( 1, raw_data.size() );
|
||||
gr::blocks::stream_to_vector::make(1, raw_data.size());
|
||||
|
||||
gr::blocks::vector_sink_b::sptr sink =
|
||||
gr::blocks::vector_sink_b::make( raw_data.size() );
|
||||
gr::blocks::vector_sink_b::make(raw_data.size());
|
||||
|
||||
|
||||
top_block->connect(source, 0, unpacker, 0);
|
||||
top_block->connect(unpacker, 0, stov, 0 );
|
||||
top_block->connect(unpacker, 0, stov, 0);
|
||||
top_block->connect(stov, 0, sink, 0);
|
||||
|
||||
top_block->run();
|
||||
@@ -300,11 +292,10 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortLittleEndianByte)
|
||||
|
||||
unpacked_data = sink->data();
|
||||
|
||||
EXPECT_EQ( raw_data.size(), unpacked_data.size() );
|
||||
|
||||
for( unsigned int i = 0; i < raw_data.size(); ++i )
|
||||
{
|
||||
EXPECT_EQ( raw_data[i], static_cast< int8_t >( unpacked_data[i] ) );
|
||||
}
|
||||
EXPECT_EQ(raw_data.size(), unpacked_data.size());
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(raw_data[i], static_cast<int8_t>(unpacked_data[i]));
|
||||
}
|
||||
}
|
||||
|
||||
+67
-68
@@ -75,8 +75,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CADllPllTelemetryDecoderTest_msg_rx(); //!< Default destructor
|
||||
|
||||
~GpsL1CADllPllTelemetryDecoderTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_msg_rx_make()
|
||||
@@ -87,19 +86,18 @@ GpsL1CADllPllTelemetryDecoderTest_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_
|
||||
void GpsL1CADllPllTelemetryDecoderTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx::GpsL1CADllPllTelemetryDecoderTest_msg_rx() :
|
||||
gr::block("GpsL1CADllPllTelemetryDecoderTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx::GpsL1CADllPllTelemetryDecoderTest_msg_rx() : gr::block("GpsL1CADllPllTelemetryDecoderTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CADllPllTelemetryDecoderTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -107,7 +105,8 @@ GpsL1CADllPllTelemetryDecoderTest_msg_rx::GpsL1CADllPllTelemetryDecoderTest_msg_
|
||||
}
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx::~GpsL1CADllPllTelemetryDecoderTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
@@ -129,8 +128,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx(); //!< Default destructor
|
||||
|
||||
~GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_make()
|
||||
@@ -141,19 +139,18 @@ GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_sptr GpsL1CADllPllTelemetryDecoderT
|
||||
void GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx() :
|
||||
gr::block("GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx() : gr::block("GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -161,13 +158,14 @@ GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::GpsL1CADllPllTelemetryDecoderTest_
|
||||
}
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::~GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
class GpsL1CATelemetryDecoderTest: public ::testing::Test
|
||||
class GpsL1CATelemetryDecoderTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
std::string generator_binary;
|
||||
@@ -184,10 +182,10 @@ public:
|
||||
|
||||
int configure_generator();
|
||||
int generate_signal();
|
||||
void check_results(arma::vec & true_time_s,
|
||||
arma::vec & true_value,
|
||||
arma::vec & meas_time_s,
|
||||
arma::vec & meas_value);
|
||||
void check_results(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value);
|
||||
|
||||
GpsL1CATelemetryDecoderTest()
|
||||
{
|
||||
@@ -198,7 +196,8 @@ public:
|
||||
}
|
||||
|
||||
~GpsL1CATelemetryDecoderTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void configure_receiver();
|
||||
|
||||
@@ -216,7 +215,7 @@ int GpsL1CATelemetryDecoderTest::configure_generator()
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if(FLAGS_dynamic_position.empty())
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(FLAGS_duration * 10);
|
||||
}
|
||||
@@ -224,9 +223,9 @@ int GpsL1CATelemetryDecoderTest::configure_generator()
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -235,7 +234,7 @@ int GpsL1CATelemetryDecoderTest::generate_signal()
|
||||
{
|
||||
int child_status;
|
||||
|
||||
char *const parmList[] = { &generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL };
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
@@ -249,7 +248,7 @@ int GpsL1CATelemetryDecoderTest::generate_signal()
|
||||
|
||||
waitpid(pid, &child_status, 0);
|
||||
|
||||
std::cout << "Signal and Observables RINEX and RAW files created." << std::endl;
|
||||
std::cout << "Signal and Observables RINEX and RAW files created." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -273,14 +272,14 @@ void GpsL1CATelemetryDecoderTest::configure_receiver()
|
||||
config->set_property("Tracking_1C.dll_bw_hz", "1.5");
|
||||
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
||||
|
||||
config->set_property("TelemetryDecoder_1C.dump","true");
|
||||
config->set_property("TelemetryDecoder_1C.dump", "true");
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CATelemetryDecoderTest::check_results(arma::vec & true_time_s,
|
||||
arma::vec & true_value,
|
||||
arma::vec & meas_time_s,
|
||||
arma::vec & meas_value)
|
||||
void GpsL1CATelemetryDecoderTest::check_results(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value)
|
||||
{
|
||||
//1. True value interpolation to match the measurement times
|
||||
arma::vec true_value_interp;
|
||||
@@ -316,7 +315,7 @@ void GpsL1CATelemetryDecoderTest::check_results(arma::vec & true_time_s,
|
||||
<< " (max,min)=" << max_error
|
||||
<< "," << min_error
|
||||
<< " [Seconds]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
|
||||
ASSERT_LT(rmse, 0.2E-6);
|
||||
ASSERT_LT(error_mean, 0.2E-6);
|
||||
@@ -366,9 +365,9 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
||||
// load acquisition data based on the first epoch of the true observations
|
||||
ASSERT_NO_THROW({
|
||||
if (true_obs_data.read_binary_obs() == false)
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
{
|
||||
throw std::exception();
|
||||
};
|
||||
}) << "Failure reading true observables file";
|
||||
|
||||
//restart the epoch counter
|
||||
@@ -379,28 +378,28 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
||||
gnss_synchro.Acq_doppler_hz = true_obs_data.doppler_l1_hz;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
std::shared_ptr<TelemetryDecoderInterface> tlm(new GpsL1CaTelemetryDecoder(config.get(), "TelemetryDecoder_1C",1, 1));
|
||||
std::shared_ptr<TelemetryDecoderInterface> tlm(new GpsL1CaTelemetryDecoder(config.get(), "TelemetryDecoder_1C", 1, 1));
|
||||
tlm->set_channel(0);
|
||||
|
||||
boost::shared_ptr<GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx> tlm_msg_rx = GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
std::string file = "./" + filename_raw_data;
|
||||
const char * file_name = file.c_str();
|
||||
ASSERT_NO_THROW({
|
||||
std::string file = "./" + filename_raw_data;
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false);
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||
top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 0);
|
||||
@@ -411,9 +410,9 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
@@ -430,15 +429,15 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
||||
arma::vec true_tow_s = arma::zeros(nepoch, 1);
|
||||
|
||||
long int epoch_counter = 0;
|
||||
while(true_obs_data.read_binary_obs())
|
||||
{
|
||||
true_timestamp_s(epoch_counter) = true_obs_data.signal_timestamp_s;
|
||||
true_acc_carrier_phase_cycles(epoch_counter) = true_obs_data.acc_carrier_phase_cycles;
|
||||
true_Doppler_Hz(epoch_counter) = true_obs_data.doppler_l1_hz;
|
||||
true_prn_delay_chips(epoch_counter) = true_obs_data.prn_delay_chips;
|
||||
true_tow_s(epoch_counter) = true_obs_data.tow;
|
||||
epoch_counter++;
|
||||
}
|
||||
while (true_obs_data.read_binary_obs())
|
||||
{
|
||||
true_timestamp_s(epoch_counter) = true_obs_data.signal_timestamp_s;
|
||||
true_acc_carrier_phase_cycles(epoch_counter) = true_obs_data.acc_carrier_phase_cycles;
|
||||
true_Doppler_Hz(epoch_counter) = true_obs_data.doppler_l1_hz;
|
||||
true_prn_delay_chips(epoch_counter) = true_obs_data.prn_delay_chips;
|
||||
true_tow_s(epoch_counter) = true_obs_data.tow;
|
||||
epoch_counter++;
|
||||
}
|
||||
|
||||
//load the measured values
|
||||
tlm_dump_reader tlm_dump;
|
||||
@@ -457,13 +456,13 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
||||
arma::vec tlm_tow_s = arma::zeros(nepoch, 1);
|
||||
|
||||
epoch_counter = 0;
|
||||
while(tlm_dump.read_binary_obs())
|
||||
{
|
||||
tlm_timestamp_s(epoch_counter) = static_cast<double>(tlm_dump.Tracking_sample_counter) / static_cast<double>(baseband_sampling_freq);
|
||||
tlm_TOW_at_Preamble(epoch_counter) = tlm_dump.d_TOW_at_Preamble;
|
||||
tlm_tow_s(epoch_counter) = tlm_dump.TOW_at_current_symbol;
|
||||
epoch_counter++;
|
||||
}
|
||||
while (tlm_dump.read_binary_obs())
|
||||
{
|
||||
tlm_timestamp_s(epoch_counter) = static_cast<double>(tlm_dump.Tracking_sample_counter) / static_cast<double>(baseband_sampling_freq);
|
||||
tlm_TOW_at_Preamble(epoch_counter) = tlm_dump.d_TOW_at_Preamble;
|
||||
tlm_tow_s(epoch_counter) = tlm_dump.TOW_at_current_symbol;
|
||||
epoch_counter++;
|
||||
}
|
||||
|
||||
//Cut measurement initial transitory of the measurements
|
||||
arma::uvec initial_meas_point = arma::find(tlm_tow_s >= true_tow_s(0), 1, "first");
|
||||
@@ -473,5 +472,5 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
||||
|
||||
check_results(true_timestamp_s, true_tow_s, tlm_timestamp_s, tlm_tow_s);
|
||||
|
||||
std::cout << "Test completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Test completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
+43
-46
@@ -46,19 +46,19 @@ DEFINE_int32(cpu_multicorrelator_real_codes_iterations_test, 100, "Number of ave
|
||||
DEFINE_int32(cpu_multicorrelator_real_codes_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test");
|
||||
|
||||
void run_correlator_cpu_real_codes(cpu_multicorrelator_real_codes* correlator,
|
||||
float d_rem_carrier_phase_rad,
|
||||
float d_carrier_phase_step_rad,
|
||||
float d_code_phase_step_chips,
|
||||
float d_rem_code_phase_chips,
|
||||
int correlation_size)
|
||||
float d_rem_carrier_phase_rad,
|
||||
float d_carrier_phase_step_rad,
|
||||
float d_code_phase_step_chips,
|
||||
float d_rem_code_phase_chips,
|
||||
int correlation_size)
|
||||
{
|
||||
for(int k = 0; k < FLAGS_cpu_multicorrelator_real_codes_iterations_test; k++)
|
||||
for (int k = 0; k < FLAGS_cpu_multicorrelator_real_codes_iterations_test; k++)
|
||||
{
|
||||
correlator->Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_size);
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,15 +70,15 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime)
|
||||
int max_threads = FLAGS_cpu_multicorrelator_real_codes_max_threads_test;
|
||||
std::vector<std::thread> thread_pool;
|
||||
cpu_multicorrelator_real_codes* correlator_pool[max_threads];
|
||||
unsigned int correlation_sizes [3] = { 2048, 4096, 8192};
|
||||
double execution_times [3];
|
||||
unsigned int correlation_sizes[3] = {2048, 4096, 8192};
|
||||
double execution_times[3];
|
||||
|
||||
float* d_ca_code;
|
||||
gr_complex* in_cpu;
|
||||
gr_complex* d_correlator_outs;
|
||||
|
||||
int d_n_correlator_taps = 3;
|
||||
int d_vector_length = correlation_sizes[2]; //max correlation size to allocate all the necessary memory
|
||||
int d_vector_length = correlation_sizes[2]; //max correlation size to allocate all the necessary memory
|
||||
float* d_local_code_shift_chips;
|
||||
|
||||
//allocate host memory
|
||||
@@ -87,16 +87,16 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime)
|
||||
in_cpu = static_cast<gr_complex*>(volk_gnsssdr_malloc(2 * d_vector_length * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
float d_early_late_spc_chips = 0.5;
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -128,37 +128,35 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime)
|
||||
float d_rem_code_phase_chips = 0.4;
|
||||
|
||||
EXPECT_NO_THROW(
|
||||
for(int correlation_sizes_idx = 0; correlation_sizes_idx < 3; correlation_sizes_idx++)
|
||||
for (int correlation_sizes_idx = 0; correlation_sizes_idx < 3; correlation_sizes_idx++) {
|
||||
for (int current_max_threads = 1; current_max_threads < (max_threads + 1); current_max_threads++)
|
||||
{
|
||||
for(int current_max_threads = 1; current_max_threads < (max_threads+1); current_max_threads++)
|
||||
std::cout << "Running " << current_max_threads << " concurrent correlators" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
//create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
std::cout << "Running " << current_max_threads << " concurrent correlators" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
//create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
thread_pool.push_back(std::thread(run_correlator_cpu_real_codes,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
}
|
||||
//wait the threads to finish they work and destroy the thread objects
|
||||
for(auto &t : thread_pool)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
thread_pool.clear();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast<double>(FLAGS_cpu_multicorrelator_real_codes_iterations_test);
|
||||
std::cout << "CPU Multicorrelator (real codes) execution time for length=" << correlation_sizes[correlation_sizes_idx]
|
||||
<< " : " << execution_times[correlation_sizes_idx] << " [s]" << std::endl;
|
||||
thread_pool.push_back(std::thread(run_correlator_cpu_real_codes,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
}
|
||||
//wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
thread_pool.clear();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast<double>(FLAGS_cpu_multicorrelator_real_codes_iterations_test);
|
||||
std::cout << "CPU Multicorrelator (real codes) execution time for length=" << correlation_sizes[correlation_sizes_idx]
|
||||
<< " : " << execution_times[correlation_sizes_idx] << " [s]" << std::endl;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
@@ -170,4 +168,3 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime)
|
||||
correlator_pool[n]->free();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+44
-47
@@ -46,19 +46,19 @@ DEFINE_int32(cpu_multicorrelator_iterations_test, 100, "Number of averaged itera
|
||||
DEFINE_int32(cpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test");
|
||||
|
||||
void run_correlator_cpu(cpu_multicorrelator* correlator,
|
||||
float d_rem_carrier_phase_rad,
|
||||
float d_carrier_phase_step_rad,
|
||||
float d_code_phase_step_chips,
|
||||
float d_rem_code_phase_chips,
|
||||
int correlation_size)
|
||||
float d_rem_carrier_phase_rad,
|
||||
float d_carrier_phase_step_rad,
|
||||
float d_code_phase_step_chips,
|
||||
float d_rem_code_phase_chips,
|
||||
int correlation_size)
|
||||
{
|
||||
for(int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++)
|
||||
for (int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++)
|
||||
{
|
||||
correlator->Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_size);
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,15 +70,15 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime)
|
||||
int max_threads = FLAGS_cpu_multicorrelator_max_threads_test;
|
||||
std::vector<std::thread> thread_pool;
|
||||
cpu_multicorrelator* correlator_pool[max_threads];
|
||||
unsigned int correlation_sizes [3] = { 2048, 4096, 8192};
|
||||
double execution_times [3];
|
||||
unsigned int correlation_sizes[3] = {2048, 4096, 8192};
|
||||
double execution_times[3];
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
gr_complex* in_cpu;
|
||||
gr_complex* d_correlator_outs;
|
||||
|
||||
int d_n_correlator_taps = 3;
|
||||
int d_vector_length = correlation_sizes[2]; //max correlation size to allocate all the necessary memory
|
||||
int d_vector_length = correlation_sizes[2]; //max correlation size to allocate all the necessary memory
|
||||
float* d_local_code_shift_chips;
|
||||
|
||||
//allocate host memory
|
||||
@@ -87,16 +87,16 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime)
|
||||
in_cpu = static_cast<gr_complex*>(volk_gnsssdr_malloc(2 * d_vector_length * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// correlator outputs (scalar)
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_correlator_outs = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
for (int n = 0; n < d_n_correlator_taps; n++)
|
||||
{
|
||||
d_correlator_outs[n] = gr_complex(0,0);
|
||||
d_correlator_outs[n] = gr_complex(0, 0);
|
||||
}
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_local_code_shift_chips = static_cast<float*>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
// Set TAPs delay values [chips]
|
||||
float d_early_late_spc_chips = 0.5;
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
|
||||
@@ -128,45 +128,42 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime)
|
||||
float d_rem_code_phase_chips = 0.4;
|
||||
|
||||
EXPECT_NO_THROW(
|
||||
for(int correlation_sizes_idx = 0; correlation_sizes_idx < 3; correlation_sizes_idx++)
|
||||
for (int correlation_sizes_idx = 0; correlation_sizes_idx < 3; correlation_sizes_idx++) {
|
||||
for (int current_max_threads = 1; current_max_threads < (max_threads + 1); current_max_threads++)
|
||||
{
|
||||
for(int current_max_threads = 1; current_max_threads < (max_threads+1); current_max_threads++)
|
||||
std::cout << "Running " << current_max_threads << " concurrent correlators" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
//create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
std::cout << "Running " << current_max_threads << " concurrent correlators" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
//create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
thread_pool.push_back(std::thread(run_correlator_cpu,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
}
|
||||
//wait the threads to finish they work and destroy the thread objects
|
||||
for(auto &t : thread_pool)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
thread_pool.clear();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast<double>(FLAGS_cpu_multicorrelator_iterations_test);
|
||||
std::cout << "CPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx]
|
||||
<< " : " << execution_times[correlation_sizes_idx] << " [s]" << std::endl;
|
||||
|
||||
thread_pool.push_back(std::thread(run_correlator_cpu,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx]));
|
||||
}
|
||||
//wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
thread_pool.clear();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast<double>(FLAGS_cpu_multicorrelator_iterations_test);
|
||||
std::cout << "CPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx]
|
||||
<< " : " << execution_times[correlation_sizes_idx] << " [s]" << std::endl;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
volk_gnsssdr_free(d_local_code_shift_chips);
|
||||
volk_gnsssdr_free(d_correlator_outs);
|
||||
volk_gnsssdr_free(d_ca_code);
|
||||
volk_gnsssdr_free(in_cpu);
|
||||
|
||||
for (int n = 0; n< max_threads; n++)
|
||||
for (int n = 0; n < max_threads; n++)
|
||||
{
|
||||
correlator_pool[n]->free();
|
||||
}
|
||||
|
||||
+22
-21
@@ -48,7 +48,7 @@
|
||||
#include "galileo_e1_dll_pll_veml_tracking.h"
|
||||
|
||||
|
||||
class GalileoE1DllPllVemlTrackingInternalTest: public ::testing::Test
|
||||
class GalileoE1DllPllVemlTrackingInternalTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE1DllPllVemlTrackingInternalTest()
|
||||
@@ -62,7 +62,8 @@ protected:
|
||||
}
|
||||
|
||||
~GalileoE1DllPllVemlTrackingInternalTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
@@ -119,15 +120,15 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun)
|
||||
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
|
||||
std::shared_ptr<GalileoE1DllPllVemlTracking> tracking = std::dynamic_pointer_cast<GalileoE1DllPllVemlTracking>(trk_);
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
@@ -139,14 +140,14 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun)
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); //Start threads and wait
|
||||
top_block->run(); //Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,8 +157,8 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
// int num_samples = 40000000; // 4 Msps
|
||||
// unsigned int skiphead_sps = 24000000; // 4 Msps
|
||||
int num_samples = 80000000; // 8 Msps
|
||||
unsigned int skiphead_sps = 8000000; // 8 Msps
|
||||
int num_samples = 80000000; // 8 Msps
|
||||
unsigned int skiphead_sps = 8000000; // 8 Msps
|
||||
init();
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Tracking test");
|
||||
@@ -168,27 +169,27 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
||||
|
||||
// gnss_synchro.Acq_delay_samples = 1753; // 4 Msps
|
||||
// gnss_synchro.Acq_doppler_hz = -9500; // 4 Msps
|
||||
gnss_synchro.Acq_delay_samples = 17256; // 8 Msps
|
||||
gnss_synchro.Acq_doppler_hz = -8750; // 8 Msps
|
||||
gnss_synchro.Acq_delay_samples = 17256; // 8 Msps
|
||||
gnss_synchro.Acq_doppler_hz = -8750; // 8 Msps
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
|
||||
const char * file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex),file_name,false);
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
gr::blocks::skiphead::sptr skip_head = gr::blocks::skiphead::make(sizeof(gr_complex), skiphead_sps);
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), num_samples, queue);
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
@@ -200,12 +201,12 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Tracked " << num_samples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Tracked " << num_samples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
+14
-14
@@ -47,7 +47,7 @@
|
||||
#include "galileo_e5a_dll_pll_tracking.h"
|
||||
|
||||
|
||||
class GalileoE5aTrackingTest: public ::testing::Test
|
||||
class GalileoE5aTrackingTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GalileoE5aTrackingTest()
|
||||
@@ -61,7 +61,8 @@ protected:
|
||||
}
|
||||
|
||||
~GalileoE5aTrackingTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
@@ -91,9 +92,9 @@ void GalileoE5aTrackingTest::init()
|
||||
config->set_property("Tracking_5X.dump_filename", "../data/e5a_tracking_ch_");
|
||||
config->set_property("Tracking_5X.early_late_space_chips", "0.5");
|
||||
config->set_property("Tracking_5X.order", "2");
|
||||
config->set_property("Tracking_5X.pll_bw_hz","20.0");
|
||||
config->set_property("Tracking_5X.pll_bw_hz", "20.0");
|
||||
config->set_property("Tracking_5X.dll_bw_hz", "5.0");
|
||||
config->set_property("Tracking_5X.pll_bw_narrow_hz","2.0");
|
||||
config->set_property("Tracking_5X.pll_bw_narrow_hz", "2.0");
|
||||
config->set_property("Tracking_5X.pll_bw_narrow_hz", "2.0");
|
||||
config->set_property("Tracking_5X.ti_ms", "1");
|
||||
}
|
||||
@@ -114,25 +115,25 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
|
||||
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
|
||||
|
||||
//REAL
|
||||
gnss_synchro.Acq_delay_samples = 10; // 32 Msps
|
||||
gnss_synchro.Acq_delay_samples = 10; // 32 Msps
|
||||
// gnss_synchro.Acq_doppler_hz = 3500; // 32 Msps
|
||||
gnss_synchro.Acq_doppler_hz = 2000; // 500 Hz resolution
|
||||
gnss_synchro.Acq_doppler_hz = 2000; // 500 Hz resolution
|
||||
// gnss_synchro.Acq_samplestamp_samples = 98000;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
@@ -143,13 +144,12 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
+22
-22
@@ -65,8 +65,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GlonassL1CaDllPllCAidTrackingTest_msg_rx(); //!< Default destructor
|
||||
|
||||
~GlonassL1CaDllPllCAidTrackingTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
GlonassL1CaDllPllCAidTrackingTest_msg_rx_sptr GlonassL1CaDllPllCAidTrackingTest_msg_rx_make()
|
||||
@@ -77,19 +76,18 @@ GlonassL1CaDllPllCAidTrackingTest_msg_rx_sptr GlonassL1CaDllPllCAidTrackingTest_
|
||||
void GlonassL1CaDllPllCAidTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlonassL1CaDllPllCAidTrackingTest_msg_rx::GlonassL1CaDllPllCAidTrackingTest_msg_rx() :
|
||||
gr::block("GlonassL1CaDllPllCAidTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GlonassL1CaDllPllCAidTrackingTest_msg_rx::GlonassL1CaDllPllCAidTrackingTest_msg_rx() : gr::block("GlonassL1CaDllPllCAidTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GlonassL1CaDllPllCAidTrackingTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -97,13 +95,14 @@ GlonassL1CaDllPllCAidTrackingTest_msg_rx::GlonassL1CaDllPllCAidTrackingTest_msg_
|
||||
}
|
||||
|
||||
GlonassL1CaDllPllCAidTrackingTest_msg_rx::~GlonassL1CaDllPllCAidTrackingTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
class GlonassL1CaDllPllCAidTrackingTest: public ::testing::Test
|
||||
class GlonassL1CaDllPllCAidTrackingTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GlonassL1CaDllPllCAidTrackingTest()
|
||||
@@ -115,7 +114,8 @@ protected:
|
||||
}
|
||||
|
||||
~GlonassL1CaDllPllCAidTrackingTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
@@ -154,7 +154,7 @@ TEST_F(GlonassL1CaDllPllCAidTrackingTest, ValidationOfResults)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
int fs_in = 6625000;
|
||||
int nsamples = fs_in*4e-3*2;
|
||||
int nsamples = fs_in * 4e-3 * 2;
|
||||
|
||||
init();
|
||||
queue = gr::msg_queue::make(0);
|
||||
@@ -167,23 +167,23 @@ TEST_F(GlonassL1CaDllPllCAidTrackingTest, ValidationOfResults)
|
||||
// gnss_synchro.Acq_doppler_hz = -2750;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
gr::analog::sig_source_c::sptr sin_source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin";
|
||||
const char * file_name = file.c_str();
|
||||
std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin";
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
@@ -195,13 +195,13 @@ TEST_F(GlonassL1CaDllPllCAidTrackingTest, ValidationOfResults)
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
// TODO: Verify tracking results
|
||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
+22
-22
@@ -65,8 +65,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GlonassL1CaDllPllTrackingTest_msg_rx(); //!< Default destructor
|
||||
|
||||
~GlonassL1CaDllPllTrackingTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
GlonassL1CaDllPllTrackingTest_msg_rx_sptr GlonassL1CaDllPllTrackingTest_msg_rx_make()
|
||||
@@ -77,19 +76,18 @@ GlonassL1CaDllPllTrackingTest_msg_rx_sptr GlonassL1CaDllPllTrackingTest_msg_rx_m
|
||||
void GlonassL1CaDllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GlonassL1CaDllPllTrackingTest_msg_rx::GlonassL1CaDllPllTrackingTest_msg_rx() :
|
||||
gr::block("GlonassL1CaDllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GlonassL1CaDllPllTrackingTest_msg_rx::GlonassL1CaDllPllTrackingTest_msg_rx() : gr::block("GlonassL1CaDllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GlonassL1CaDllPllTrackingTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -97,13 +95,14 @@ GlonassL1CaDllPllTrackingTest_msg_rx::GlonassL1CaDllPllTrackingTest_msg_rx() :
|
||||
}
|
||||
|
||||
GlonassL1CaDllPllTrackingTest_msg_rx::~GlonassL1CaDllPllTrackingTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
class GlonassL1CaDllPllTrackingTest: public ::testing::Test
|
||||
class GlonassL1CaDllPllTrackingTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GlonassL1CaDllPllTrackingTest()
|
||||
@@ -115,7 +114,8 @@ protected:
|
||||
}
|
||||
|
||||
~GlonassL1CaDllPllTrackingTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
@@ -153,7 +153,7 @@ TEST_F(GlonassL1CaDllPllTrackingTest, ValidationOfResults)
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
std::chrono::duration<double> elapsed_seconds(0);
|
||||
int fs_in = 6625000;
|
||||
int nsamples = fs_in*4e-3*2;
|
||||
int nsamples = fs_in * 4e-3 * 2;
|
||||
|
||||
init();
|
||||
queue = gr::msg_queue::make(0);
|
||||
@@ -166,23 +166,23 @@ TEST_F(GlonassL1CaDllPllTrackingTest, ValidationOfResults)
|
||||
// gnss_synchro.Acq_doppler_hz = -2750;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
gr::analog::sig_source_c::sptr sin_source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin";
|
||||
const char * file_name = file.c_str();
|
||||
std::string file = path + "signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin";
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
@@ -194,13 +194,13 @@ TEST_F(GlonassL1CaDllPllTrackingTest, ValidationOfResults)
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
// TODO: Verify tracking results
|
||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
+74
-75
@@ -72,7 +72,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CADllPllTrackingTest_msg_rx(); //!< Default destructor
|
||||
~GpsL1CADllPllTrackingTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -85,20 +85,19 @@ GpsL1CADllPllTrackingTest_msg_rx_sptr GpsL1CADllPllTrackingTest_msg_rx_make()
|
||||
void GpsL1CADllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() :
|
||||
gr::block("GpsL1CADllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() : gr::block("GpsL1CADllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CADllPllTrackingTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -107,12 +106,13 @@ GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() :
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingTest_msg_rx::~GpsL1CADllPllTrackingTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CADllPllTrackingTest: public ::testing::Test
|
||||
class GpsL1CADllPllTrackingTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
std::string generator_binary;
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
std::string p4;
|
||||
std::string p5;
|
||||
|
||||
std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; //"GPS_L1_CA_DLL_PLL_C_Aid_Tracking";
|
||||
std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; //"GPS_L1_CA_DLL_PLL_C_Aid_Tracking";
|
||||
|
||||
const int baseband_sampling_freq = FLAGS_fs_gen_sps;
|
||||
|
||||
@@ -131,18 +131,18 @@ public:
|
||||
|
||||
int configure_generator();
|
||||
int generate_signal();
|
||||
void check_results_doppler(arma::vec & true_time_s,
|
||||
arma::vec & true_value,
|
||||
arma::vec & meas_time_s,
|
||||
arma::vec & meas_value);
|
||||
void check_results_acc_carrier_phase(arma::vec & true_time_s,
|
||||
arma::vec & true_value,
|
||||
arma::vec & meas_time_s,
|
||||
arma::vec & meas_value);
|
||||
void check_results_codephase(arma::vec & true_time_s,
|
||||
arma::vec & true_value,
|
||||
arma::vec & meas_time_s,
|
||||
arma::vec & meas_value);
|
||||
void check_results_doppler(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value);
|
||||
void check_results_acc_carrier_phase(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value);
|
||||
void check_results_codephase(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value);
|
||||
|
||||
GpsL1CADllPllTrackingTest()
|
||||
{
|
||||
@@ -153,7 +153,8 @@ public:
|
||||
}
|
||||
|
||||
~GpsL1CADllPllTrackingTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void configure_receiver();
|
||||
|
||||
@@ -171,7 +172,7 @@ int GpsL1CADllPllTrackingTest::configure_generator()
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if(FLAGS_dynamic_position.empty())
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(FLAGS_duration * 10);
|
||||
}
|
||||
@@ -179,9 +180,9 @@ int GpsL1CADllPllTrackingTest::configure_generator()
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -190,7 +191,7 @@ int GpsL1CADllPllTrackingTest::generate_signal()
|
||||
{
|
||||
int child_status;
|
||||
|
||||
char *const parmList[] = { &generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL };
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
@@ -204,7 +205,7 @@ int GpsL1CADllPllTrackingTest::generate_signal()
|
||||
|
||||
waitpid(pid, &child_status, 0);
|
||||
|
||||
std::cout << "Signal and Observables RINEX and RAW files created." << std::endl;
|
||||
std::cout << "Signal and Observables RINEX and RAW files created." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -230,10 +231,10 @@ void GpsL1CADllPllTrackingTest::configure_receiver()
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec & true_time_s,
|
||||
arma::vec & true_value,
|
||||
arma::vec & meas_time_s,
|
||||
arma::vec & meas_value)
|
||||
void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value)
|
||||
{
|
||||
// 1. True value interpolation to match the measurement times
|
||||
arma::vec true_value_interp;
|
||||
@@ -266,14 +267,14 @@ void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec & true_time_s,
|
||||
std::cout << std::setprecision(10) << "TRK Doppler RMSE=" << rmse
|
||||
<< ", mean=" << error_mean
|
||||
<< ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Hz]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec & true_time_s,
|
||||
arma::vec & true_value,
|
||||
arma::vec & meas_time_s,
|
||||
arma::vec & meas_value)
|
||||
void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value)
|
||||
{
|
||||
// 1. True value interpolation to match the measurement times
|
||||
arma::vec true_value_interp;
|
||||
@@ -305,14 +306,14 @@ void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec & true
|
||||
std::cout << std::setprecision(10) << "TRK acc carrier phase RMSE=" << rmse
|
||||
<< ", mean=" << error_mean
|
||||
<< ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Hz]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec & true_time_s,
|
||||
arma::vec & true_value,
|
||||
arma::vec & meas_time_s,
|
||||
arma::vec & meas_value)
|
||||
void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value)
|
||||
{
|
||||
// 1. True value interpolation to match the measurement times
|
||||
arma::vec true_value_interp;
|
||||
@@ -345,7 +346,7 @@ void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec & true_time_s,
|
||||
std::cout << std::setprecision(10) << "TRK code phase RMSE=" << rmse
|
||||
<< ", mean=" << error_mean
|
||||
<< ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Chips]" << std::endl;
|
||||
std::cout.precision (ss);
|
||||
std::cout.precision(ss);
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +377,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
top_block = gr::make_top_block("Tracking test");
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1);
|
||||
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);//std::make_shared<GpsL1CaDllPllCAidTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_); //std::make_shared<GpsL1CaDllPllCAidTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||
|
||||
boost::shared_ptr<GpsL1CADllPllTrackingTest_msg_rx> msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make();
|
||||
|
||||
@@ -384,7 +385,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
ASSERT_EQ(true_obs_data.read_binary_obs(), true)
|
||||
<< "Failure reading true tracking dump file." << std::endl
|
||||
<< "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) +
|
||||
" is not available?";
|
||||
" is not available?";
|
||||
|
||||
// restart the epoch counter
|
||||
true_obs_data.restart();
|
||||
@@ -394,23 +395,23 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
gnss_synchro.Acq_doppler_hz = true_obs_data.doppler_l1_hz;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
std::string file = "./" + filename_raw_data;
|
||||
const char * file_name = file.c_str();
|
||||
ASSERT_NO_THROW({
|
||||
std::string file = "./" + filename_raw_data;
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false);
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||
top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 0);
|
||||
@@ -420,9 +421,9 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
@@ -438,7 +439,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
arma::vec true_tow_s = arma::zeros(nepoch, 1);
|
||||
|
||||
long int epoch_counter = 0;
|
||||
while(true_obs_data.read_binary_obs())
|
||||
while (true_obs_data.read_binary_obs())
|
||||
{
|
||||
true_timestamp_s(epoch_counter) = true_obs_data.signal_timestamp_s;
|
||||
true_acc_carrier_phase_cycles(epoch_counter) = true_obs_data.acc_carrier_phase_cycles;
|
||||
@@ -452,7 +453,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
tracking_dump_reader trk_dump;
|
||||
|
||||
ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true)
|
||||
<< "Failure opening tracking dump file";
|
||||
<< "Failure opening tracking dump file";
|
||||
|
||||
nepoch = trk_dump.num_epochs();
|
||||
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
||||
@@ -469,14 +470,13 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
std::vector<double> promptQ;
|
||||
|
||||
epoch_counter = 0;
|
||||
while(trk_dump.read_binary_obs())
|
||||
while (trk_dump.read_binary_obs())
|
||||
{
|
||||
trk_timestamp_s(epoch_counter) = static_cast<double>(trk_dump.PRN_start_sample_count) / static_cast<double>(baseband_sampling_freq);
|
||||
trk_acc_carrier_phase_cycles(epoch_counter) = trk_dump.acc_carrier_phase_rad / GPS_TWO_PI;
|
||||
trk_Doppler_Hz(epoch_counter) = trk_dump.carrier_doppler_hz;
|
||||
|
||||
double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS
|
||||
* (fmod((static_cast<double>(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast<double>(baseband_sampling_freq), 1.0e-3) / 1.0e-3);
|
||||
double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS * (fmod((static_cast<double>(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast<double>(baseband_sampling_freq), 1.0e-3) / 1.0e-3);
|
||||
|
||||
trk_prn_delay_chips(epoch_counter) = delay_chips;
|
||||
epoch_counter++;
|
||||
@@ -503,10 +503,10 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "Signal tracking completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
|
||||
if(FLAGS_plot_gps_l1_tracking_test == true)
|
||||
if (FLAGS_plot_gps_l1_tracking_test == true)
|
||||
{
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
if(gnuplot_executable.empty())
|
||||
if (gnuplot_executable.empty())
|
||||
{
|
||||
std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE," << std::endl;
|
||||
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||
@@ -515,7 +515,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
@@ -535,12 +535,12 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
g1.set_ylabel("Correlators' output");
|
||||
g1.cmd("set key box opaque");
|
||||
unsigned int decimate = static_cast<unsigned int>(FLAGS_plot_decimate);
|
||||
g1.plot_xy( timevec, prompt, "Prompt", decimate);
|
||||
g1.plot_xy( timevec, early, "Early", decimate);
|
||||
g1.plot_xy( timevec, late, "Late", decimate);
|
||||
g1.plot_xy(timevec, prompt, "Prompt", decimate);
|
||||
g1.plot_xy(timevec, early, "Early", decimate);
|
||||
g1.plot_xy(timevec, late, "Late", decimate);
|
||||
g1.savetops("Correlators_outputs");
|
||||
g1.savetopdf("Correlators_outputs", 18);
|
||||
g1.showonscreen(); // window output
|
||||
g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("points");
|
||||
g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
@@ -548,16 +548,15 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
g2.set_xlabel("Inphase");
|
||||
g2.set_ylabel("Quadrature");
|
||||
g2.cmd("set size ratio -1");
|
||||
g2.plot_xy( promptI, promptQ);
|
||||
g2.plot_xy(promptI, promptQ);
|
||||
g2.savetops("Constellation");
|
||||
g2.savetopdf("Constellation", 18);
|
||||
g2.showonscreen(); // window output
|
||||
|
||||
}
|
||||
catch (const GnuplotException & ge)
|
||||
{
|
||||
g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-22
@@ -65,8 +65,7 @@ private:
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL2MDllPllTrackingTest_msg_rx(); //!< Default destructor
|
||||
|
||||
~GpsL2MDllPllTrackingTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
@@ -79,20 +78,19 @@ GpsL2MDllPllTrackingTest_msg_rx_sptr GpsL2MDllPllTrackingTest_msg_rx_make()
|
||||
void GpsL2MDllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL2MDllPllTrackingTest_msg_rx::GpsL2MDllPllTrackingTest_msg_rx() :
|
||||
gr::block("GpsL2MDllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
GpsL2MDllPllTrackingTest_msg_rx::GpsL2MDllPllTrackingTest_msg_rx() : gr::block("GpsL2MDllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL2MDllPllTrackingTest_msg_rx::msg_handler_events, this, _1));
|
||||
@@ -101,12 +99,13 @@ GpsL2MDllPllTrackingTest_msg_rx::GpsL2MDllPllTrackingTest_msg_rx() :
|
||||
|
||||
|
||||
GpsL2MDllPllTrackingTest_msg_rx::~GpsL2MDllPllTrackingTest_msg_rx()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL2MDllPllTrackingTest: public ::testing::Test
|
||||
class GpsL2MDllPllTrackingTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GpsL2MDllPllTrackingTest()
|
||||
@@ -118,7 +117,8 @@ protected:
|
||||
}
|
||||
|
||||
~GpsL2MDllPllTrackingTest()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
@@ -168,23 +168,23 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults)
|
||||
gnss_synchro.Acq_doppler_hz = 1200;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
ASSERT_NO_THROW({
|
||||
//gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "signal_samples/gps_l2c_m_prn7_5msps.dat";
|
||||
const char * file_name = file.c_str();
|
||||
std::string file = path + "signal_samples/gps_l2c_m_prn7_5msps.dat";
|
||||
const char* file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
@@ -196,14 +196,13 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults)
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
// TODO: Verify tracking results
|
||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
+47
-49
@@ -44,21 +44,21 @@ DEFINE_int32(gpu_multicorrelator_iterations_test, 1000, "Number of averaged iter
|
||||
DEFINE_int32(gpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in GPU multicorrelator test timing test");
|
||||
|
||||
void run_correlator_gpu(cuda_multicorrelator* correlator,
|
||||
float d_rem_carrier_phase_rad,
|
||||
float d_carrier_phase_step_rad,
|
||||
float d_code_phase_step_chips,
|
||||
float d_rem_code_phase_chips,
|
||||
int correlation_size,
|
||||
int d_n_correlator_taps)
|
||||
float d_rem_carrier_phase_rad,
|
||||
float d_carrier_phase_step_rad,
|
||||
float d_code_phase_step_chips,
|
||||
float d_rem_code_phase_chips,
|
||||
int correlation_size,
|
||||
int d_n_correlator_taps)
|
||||
{
|
||||
for(int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++)
|
||||
for (int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++)
|
||||
{
|
||||
correlator->Carrier_wipeoff_multicorrelator_resampler_cuda(d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_size,
|
||||
d_n_correlator_taps);
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_size,
|
||||
d_n_correlator_taps);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,28 +70,28 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime)
|
||||
int max_threads = FLAGS_gpu_multicorrelator_max_threads_test;
|
||||
std::vector<std::thread> thread_pool;
|
||||
cuda_multicorrelator* correlator_pool[max_threads];
|
||||
unsigned int correlation_sizes [3] = { 2048, 4096, 8192};
|
||||
double execution_times [3];
|
||||
unsigned int correlation_sizes[3] = {2048, 4096, 8192};
|
||||
double execution_times[3];
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
gr_complex* in_gpu;
|
||||
gr_complex* d_correlator_outs;
|
||||
|
||||
int d_n_correlator_taps = 3;
|
||||
int d_vector_length = correlation_sizes[2]; //max correlation size to allocate all the necessary memory
|
||||
int d_vector_length = correlation_sizes[2]; //max correlation size to allocate all the necessary memory
|
||||
float* d_local_code_shift_chips;
|
||||
// Set GPU flags
|
||||
cudaSetDeviceFlags(cudaDeviceMapHost);
|
||||
//allocate host memory
|
||||
//pinned memory mode - use special function to get OS-pinned memory
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
d_n_correlator_taps = 3; // Early, Prompt, and Late
|
||||
// Get space for a vector with the C/A code replica sampled 1x/chip
|
||||
cudaHostAlloc((void**)&d_ca_code, (static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS)* sizeof(gr_complex)), cudaHostAllocMapped | cudaHostAllocWriteCombined);
|
||||
cudaHostAlloc((void**)&d_ca_code, (static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), cudaHostAllocMapped | cudaHostAllocWriteCombined);
|
||||
// Get space for the resampled early / prompt / late local replicas
|
||||
cudaHostAlloc((void**)&d_local_code_shift_chips, d_n_correlator_taps * sizeof(float), cudaHostAllocMapped | cudaHostAllocWriteCombined);
|
||||
cudaHostAlloc((void**)&d_local_code_shift_chips, d_n_correlator_taps * sizeof(float), cudaHostAllocMapped | cudaHostAllocWriteCombined);
|
||||
cudaHostAlloc((void**)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped | cudaHostAllocWriteCombined);
|
||||
// correlator outputs (scalar)
|
||||
cudaHostAlloc((void**)&d_correlator_outs ,sizeof(gr_complex)*d_n_correlator_taps, cudaHostAllocMapped | cudaHostAllocWriteCombined );
|
||||
cudaHostAlloc((void**)&d_correlator_outs, sizeof(gr_complex) * d_n_correlator_taps, cudaHostAllocMapped | cudaHostAllocWriteCombined);
|
||||
|
||||
//--- Perform initializations ------------------------------
|
||||
//local code resampler on GPU
|
||||
@@ -104,7 +104,7 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime)
|
||||
}
|
||||
// Set TAPs delay values [chips]
|
||||
float d_early_late_spc_chips = 0.5;
|
||||
d_local_code_shift_chips[0] = - d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[0] = -d_early_late_spc_chips;
|
||||
d_local_code_shift_chips[1] = 0.0;
|
||||
d_local_code_shift_chips[2] = d_early_late_spc_chips;
|
||||
for (int n = 0; n < max_threads; n++)
|
||||
@@ -120,39 +120,37 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime)
|
||||
float d_rem_code_phase_chips = 0.4;
|
||||
|
||||
EXPECT_NO_THROW(
|
||||
for(int correlation_sizes_idx = 0; correlation_sizes_idx < 3; correlation_sizes_idx++)
|
||||
for (int correlation_sizes_idx = 0; correlation_sizes_idx < 3; correlation_sizes_idx++) {
|
||||
for (int current_max_threads = 1; current_max_threads < (max_threads + 1); current_max_threads++)
|
||||
{
|
||||
for(int current_max_threads = 1; current_max_threads < (max_threads+1); current_max_threads++)
|
||||
std::cout << "Running " << current_max_threads << " concurrent correlators" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
//create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
std::cout << "Running " << current_max_threads << " concurrent correlators" << std::endl;
|
||||
start = std::chrono::system_clock::now();
|
||||
//create the concurrent correlator threads
|
||||
for (int current_thread = 0; current_thread < current_max_threads; current_thread++)
|
||||
{
|
||||
//cudaProfilerStart();
|
||||
thread_pool.push_back(std::thread(run_correlator_gpu,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx],
|
||||
d_n_correlator_taps));
|
||||
//cudaProfilerStop();
|
||||
}
|
||||
//wait the threads to finish they work and destroy the thread objects
|
||||
for(auto &t : thread_pool)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
thread_pool.clear();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast<double>(FLAGS_gpu_multicorrelator_iterations_test);
|
||||
std::cout << "GPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]" << std::endl;
|
||||
//cudaProfilerStart();
|
||||
thread_pool.push_back(std::thread(run_correlator_gpu,
|
||||
correlator_pool[current_thread],
|
||||
d_rem_carrier_phase_rad,
|
||||
d_carrier_phase_step_rad,
|
||||
d_code_phase_step_chips,
|
||||
d_rem_code_phase_chips,
|
||||
correlation_sizes[correlation_sizes_idx],
|
||||
d_n_correlator_taps));
|
||||
//cudaProfilerStop();
|
||||
}
|
||||
//wait the threads to finish they work and destroy the thread objects
|
||||
for (auto& t : thread_pool)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
thread_pool.clear();
|
||||
end = std::chrono::system_clock::now();
|
||||
elapsed_seconds = end - start;
|
||||
execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast<double>(FLAGS_gpu_multicorrelator_iterations_test);
|
||||
std::cout << "GPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]" << std::endl;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
cudaFreeHost(in_gpu);
|
||||
cudaFreeHost(d_correlator_outs);
|
||||
|
||||
+83
-86
@@ -39,27 +39,27 @@ TEST(TrackingLoopFilterTest, FirstOrderLoop)
|
||||
float update_interval = 0.001;
|
||||
bool include_last_integrator = false;
|
||||
|
||||
Tracking_loop_filter theFilter( update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator );
|
||||
Tracking_loop_filter theFilter(update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator);
|
||||
|
||||
EXPECT_EQ( theFilter.get_noise_bandwidth(), noise_bandwidth );
|
||||
EXPECT_EQ( theFilter.get_update_interval(), update_interval );
|
||||
EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator );
|
||||
EXPECT_EQ( theFilter.get_order(), loop_order );
|
||||
EXPECT_EQ(theFilter.get_noise_bandwidth(), noise_bandwidth);
|
||||
EXPECT_EQ(theFilter.get_update_interval(), update_interval);
|
||||
EXPECT_EQ(theFilter.get_include_last_integrator(), include_last_integrator);
|
||||
EXPECT_EQ(theFilter.get_order(), loop_order);
|
||||
|
||||
std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 };
|
||||
std::vector<float> sample_data = {0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
|
||||
|
||||
theFilter.initialize( 0.0 );
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float g1 = noise_bandwidth * 4.0;
|
||||
|
||||
float result = 0.0;
|
||||
for( unsigned int i = 0; i < sample_data.size(); ++i )
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply( sample_data[i] );
|
||||
EXPECT_FLOAT_EQ( result, sample_data[i]*g1 );
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_FLOAT_EQ(result, sample_data[i] * g1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,31 +71,30 @@ TEST(TrackingLoopFilterTest, FirstOrderLoopWithLastIntegrator)
|
||||
float update_interval = 0.001;
|
||||
bool include_last_integrator = true;
|
||||
|
||||
Tracking_loop_filter theFilter( update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator );
|
||||
Tracking_loop_filter theFilter(update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator);
|
||||
|
||||
EXPECT_EQ( theFilter.get_noise_bandwidth(), noise_bandwidth );
|
||||
EXPECT_EQ( theFilter.get_update_interval(), update_interval );
|
||||
EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator );
|
||||
EXPECT_EQ( theFilter.get_order(), loop_order );
|
||||
EXPECT_EQ(theFilter.get_noise_bandwidth(), noise_bandwidth);
|
||||
EXPECT_EQ(theFilter.get_update_interval(), update_interval);
|
||||
EXPECT_EQ(theFilter.get_include_last_integrator(), include_last_integrator);
|
||||
EXPECT_EQ(theFilter.get_order(), loop_order);
|
||||
|
||||
std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 };
|
||||
std::vector< float > expected_out = { 0.0, 0.0, 0.01, 0.02, 0.02, 0.02 };
|
||||
std::vector<float> sample_data = {0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
|
||||
std::vector<float> expected_out = {0.0, 0.0, 0.01, 0.02, 0.02, 0.02};
|
||||
|
||||
theFilter.initialize( 0.0 );
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for( unsigned int i = 0; i < sample_data.size(); ++i )
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply( sample_data[i] );
|
||||
EXPECT_NEAR( result, expected_out[i], 1e-4 );
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(TrackingLoopFilterTest, SecondOrderLoop)
|
||||
{
|
||||
int loop_order = 2;
|
||||
@@ -103,26 +102,26 @@ TEST(TrackingLoopFilterTest, SecondOrderLoop)
|
||||
float update_interval = 0.001;
|
||||
bool include_last_integrator = false;
|
||||
|
||||
Tracking_loop_filter theFilter( update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator );
|
||||
Tracking_loop_filter theFilter(update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator);
|
||||
|
||||
EXPECT_EQ( theFilter.get_noise_bandwidth(), noise_bandwidth );
|
||||
EXPECT_EQ( theFilter.get_update_interval(), update_interval );
|
||||
EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator );
|
||||
EXPECT_EQ( theFilter.get_order(), loop_order );
|
||||
EXPECT_EQ(theFilter.get_noise_bandwidth(), noise_bandwidth);
|
||||
EXPECT_EQ(theFilter.get_update_interval(), update_interval);
|
||||
EXPECT_EQ(theFilter.get_include_last_integrator(), include_last_integrator);
|
||||
EXPECT_EQ(theFilter.get_order(), loop_order);
|
||||
|
||||
std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 };
|
||||
std::vector< float > expected_out = { 0.0, 0.0, 13.37778, 0.0889, 0.0889, 0.0889 };
|
||||
std::vector<float> sample_data = {0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
|
||||
std::vector<float> expected_out = {0.0, 0.0, 13.37778, 0.0889, 0.0889, 0.0889};
|
||||
|
||||
theFilter.initialize( 0.0 );
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for( unsigned int i = 0; i < sample_data.size(); ++i )
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply( sample_data[i] );
|
||||
EXPECT_NEAR( result, expected_out[i], 1e-4 );
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,26 +133,26 @@ TEST(TrackingLoopFilterTest, SecondOrderLoopWithLastIntegrator)
|
||||
float update_interval = 0.001;
|
||||
bool include_last_integrator = true;
|
||||
|
||||
Tracking_loop_filter theFilter( update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator );
|
||||
Tracking_loop_filter theFilter(update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator);
|
||||
|
||||
EXPECT_EQ( theFilter.get_noise_bandwidth(), noise_bandwidth );
|
||||
EXPECT_EQ( theFilter.get_update_interval(), update_interval );
|
||||
EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator );
|
||||
EXPECT_EQ( theFilter.get_order(), loop_order );
|
||||
EXPECT_EQ(theFilter.get_noise_bandwidth(), noise_bandwidth);
|
||||
EXPECT_EQ(theFilter.get_update_interval(), update_interval);
|
||||
EXPECT_EQ(theFilter.get_include_last_integrator(), include_last_integrator);
|
||||
EXPECT_EQ(theFilter.get_order(), loop_order);
|
||||
|
||||
std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 };
|
||||
std::vector< float > expected_out = { 0.0, 0.0, 0.006689, 0.013422, 0.013511, 0.013600 };
|
||||
std::vector<float> sample_data = {0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
|
||||
std::vector<float> expected_out = {0.0, 0.0, 0.006689, 0.013422, 0.013511, 0.013600};
|
||||
|
||||
theFilter.initialize( 0.0 );
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for( unsigned int i = 0; i < sample_data.size(); ++i )
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply( sample_data[i] );
|
||||
EXPECT_NEAR( result, expected_out[i], 1e-4 );
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,26 +164,26 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoop)
|
||||
float update_interval = 0.001;
|
||||
bool include_last_integrator = false;
|
||||
|
||||
Tracking_loop_filter theFilter( update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator );
|
||||
Tracking_loop_filter theFilter(update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator);
|
||||
|
||||
EXPECT_EQ( theFilter.get_noise_bandwidth(), noise_bandwidth );
|
||||
EXPECT_EQ( theFilter.get_update_interval(), update_interval );
|
||||
EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator );
|
||||
EXPECT_EQ( theFilter.get_order(), loop_order );
|
||||
EXPECT_EQ(theFilter.get_noise_bandwidth(), noise_bandwidth);
|
||||
EXPECT_EQ(theFilter.get_update_interval(), update_interval);
|
||||
EXPECT_EQ(theFilter.get_include_last_integrator(), include_last_integrator);
|
||||
EXPECT_EQ(theFilter.get_order(), loop_order);
|
||||
|
||||
std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 };
|
||||
std::vector< float > expected_out = { 0.0, 0.0, 15.31877, 0.04494, 0.04520, 0.04546};
|
||||
std::vector<float> sample_data = {0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
|
||||
std::vector<float> expected_out = {0.0, 0.0, 15.31877, 0.04494, 0.04520, 0.04546};
|
||||
|
||||
theFilter.initialize( 0.0 );
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for( unsigned int i = 0; i < sample_data.size(); ++i )
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply( sample_data[i] );
|
||||
EXPECT_NEAR( result, expected_out[i], 1e-4 );
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,27 +195,25 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoopWithLastIntegrator)
|
||||
float update_interval = 0.001;
|
||||
bool include_last_integrator = true;
|
||||
|
||||
Tracking_loop_filter theFilter( update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator );
|
||||
Tracking_loop_filter theFilter(update_interval,
|
||||
noise_bandwidth,
|
||||
loop_order,
|
||||
include_last_integrator);
|
||||
|
||||
EXPECT_EQ( theFilter.get_noise_bandwidth(), noise_bandwidth );
|
||||
EXPECT_EQ( theFilter.get_update_interval(), update_interval );
|
||||
EXPECT_EQ( theFilter.get_include_last_integrator(), include_last_integrator );
|
||||
EXPECT_EQ( theFilter.get_order(), loop_order );
|
||||
EXPECT_EQ(theFilter.get_noise_bandwidth(), noise_bandwidth);
|
||||
EXPECT_EQ(theFilter.get_update_interval(), update_interval);
|
||||
EXPECT_EQ(theFilter.get_include_last_integrator(), include_last_integrator);
|
||||
EXPECT_EQ(theFilter.get_order(), loop_order);
|
||||
|
||||
std::vector< float > sample_data = { 0.0, 0.0, 1.0, 0.0, 0.0, 0.0 };
|
||||
std::vector< float > expected_out = { 0.0, 0.0, 0.007659, 0.015341, 0.015386, 0.015432};
|
||||
std::vector<float> sample_data = {0.0, 0.0, 1.0, 0.0, 0.0, 0.0};
|
||||
std::vector<float> expected_out = {0.0, 0.0, 0.007659, 0.015341, 0.015386, 0.015432};
|
||||
|
||||
theFilter.initialize( 0.0 );
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for( unsigned int i = 0; i < sample_data.size(); ++i )
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply( sample_data[i] );
|
||||
EXPECT_NEAR( result, expected_out[i], 1e-4 );
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,12 +53,12 @@ TEST(GlonassGnavEphemerisTest, ComputeGlonassTime)
|
||||
expected_gtime = gtime.time_of_day();
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(expected_gdate.year() - d.year() < FLT_EPSILON );
|
||||
ASSERT_TRUE(expected_gdate.month() - d.month() < FLT_EPSILON );
|
||||
ASSERT_TRUE(expected_gdate.day() - d.day() < FLT_EPSILON );
|
||||
ASSERT_TRUE(expected_gtime.hours() - t.hours() < FLT_EPSILON );
|
||||
ASSERT_TRUE(expected_gtime.minutes() - t.minutes() < FLT_EPSILON );
|
||||
ASSERT_TRUE(expected_gtime.seconds() - t.seconds() < FLT_EPSILON );
|
||||
ASSERT_TRUE(expected_gdate.year() - d.year() < FLT_EPSILON);
|
||||
ASSERT_TRUE(expected_gdate.month() - d.month() < FLT_EPSILON);
|
||||
ASSERT_TRUE(expected_gdate.day() - d.day() < FLT_EPSILON);
|
||||
ASSERT_TRUE(expected_gtime.hours() - t.hours() < FLT_EPSILON);
|
||||
ASSERT_TRUE(expected_gtime.minutes() - t.minutes() < FLT_EPSILON);
|
||||
ASSERT_TRUE(expected_gtime.seconds() - t.seconds() < FLT_EPSILON);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,21 +70,21 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT1)
|
||||
{
|
||||
Glonass_Gnav_Ephemeris gnav_eph;
|
||||
gnav_eph.d_yr = 2004;
|
||||
gnav_eph.d_N_T = 366+28;
|
||||
gnav_eph.d_N_T = 366 + 28;
|
||||
|
||||
double glo2utc = 3600*3;
|
||||
double glo2utc = 3600 * 3;
|
||||
double tod = 48600;
|
||||
double week = 0.0;
|
||||
double tow = 0.0;
|
||||
double true_leap_sec = 13;
|
||||
double true_week = 1307;
|
||||
double true_tow = 480600+true_leap_sec;
|
||||
double true_tow = 480600 + true_leap_sec;
|
||||
|
||||
gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(week - true_week < FLT_EPSILON );
|
||||
ASSERT_TRUE(tow - true_tow < FLT_EPSILON );
|
||||
ASSERT_TRUE(week - true_week < FLT_EPSILON);
|
||||
ASSERT_TRUE(tow - true_tow < FLT_EPSILON);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,19 +98,19 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT2)
|
||||
gnav_eph.d_yr = 2016;
|
||||
gnav_eph.d_N_T = 268;
|
||||
|
||||
double glo2utc = 3600*3;
|
||||
double glo2utc = 3600 * 3;
|
||||
double tod = 7560;
|
||||
double week = 0.0;
|
||||
double tow = 0.0;
|
||||
double true_leap_sec = 17;
|
||||
double true_week = 1915;
|
||||
double true_tow = 518400+true_leap_sec+tod;
|
||||
double true_tow = 518400 + true_leap_sec + tod;
|
||||
|
||||
gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(week - true_week < FLT_EPSILON );
|
||||
ASSERT_TRUE(tow - true_tow < FLT_EPSILON );
|
||||
ASSERT_TRUE(week - true_week < FLT_EPSILON);
|
||||
ASSERT_TRUE(tow - true_tow < FLT_EPSILON);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,17 +124,17 @@ TEST(GlonassGnavEphemerisTest, ConvertGlonassT2GpsT3)
|
||||
gnav_eph.d_yr = 2016;
|
||||
gnav_eph.d_N_T = 62;
|
||||
|
||||
double glo2utc = 3600*3;
|
||||
double glo2utc = 3600 * 3;
|
||||
double tod = 7560;
|
||||
double week = 0.0;
|
||||
double tow = 0.0;
|
||||
double true_leap_sec = 17;
|
||||
double true_week = 1886;
|
||||
double true_tow = 259200+true_leap_sec+tod;
|
||||
double true_tow = 259200 + true_leap_sec + tod;
|
||||
|
||||
gnav_eph.glot_to_gpst(tod + glo2utc, 0.0, 0.0, &week, &tow);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(week - true_week < FLT_EPSILON );
|
||||
ASSERT_TRUE(tow - true_tow < FLT_EPSILON );
|
||||
ASSERT_TRUE(week - true_week < FLT_EPSILON);
|
||||
ASSERT_TRUE(tow - true_tow < FLT_EPSILON);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ TEST(GlonassGnavNavigationMessageTest, CRCTestSuccess)
|
||||
{
|
||||
// Variables declarations in code
|
||||
bool test_result;
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits (std::string ("0010100100001100000000000000000000000000110011110001100000000000000001100100011000000"));
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits(std::string("0010100100001100000000000000000000000000110011110001100000000000000001100100011000000"));
|
||||
Glonass_Gnav_Navigation_Message gnav_nav_message;
|
||||
gnav_nav_message.reset();
|
||||
|
||||
@@ -65,7 +65,7 @@ TEST(GlonassGnavNavigationMessageTest, CRCTestFailure)
|
||||
// Variables declarations in code
|
||||
bool test_result;
|
||||
// Constructor of string to bitset will flip the order of the bits. Needed for CRC computation
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits (std::string ("0111100100001100000000000000000000000000110011110001100000000000000001100100011000000"));
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits(std::string("0111100100001100000000000000000000000000110011110001100000000000000001100100011000000"));
|
||||
Glonass_Gnav_Navigation_Message gnav_nav_message;
|
||||
gnav_nav_message.reset();
|
||||
|
||||
@@ -92,21 +92,21 @@ TEST(GlonassGnavNavigationMessageTest, String1Decoder)
|
||||
Glonass_Gnav_Ephemeris gnav_ephemeris;
|
||||
|
||||
// Fill out ephemeris values for truth
|
||||
gnav_ephemeris.d_P_1 = 15;
|
||||
gnav_ephemeris.d_t_k = 7560;
|
||||
gnav_ephemeris.d_VXn = -0.490900039672852;
|
||||
gnav_ephemeris.d_AXn = 0;
|
||||
gnav_ephemeris.d_Xn = -11025.6669921875;
|
||||
gnav_ephemeris.d_P_1 = 15;
|
||||
gnav_ephemeris.d_t_k = 7560;
|
||||
gnav_ephemeris.d_VXn = -0.490900039672852;
|
||||
gnav_ephemeris.d_AXn = 0;
|
||||
gnav_ephemeris.d_Xn = -11025.6669921875;
|
||||
|
||||
// Call target test method
|
||||
gnav_nav_message.string_decoder(str1);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_1 - gnav_nav_message.gnav_ephemeris.d_P_1 < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_t_k - gnav_nav_message.gnav_ephemeris.d_t_k < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_VXn - gnav_nav_message.gnav_ephemeris.d_VXn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_AXn - gnav_nav_message.gnav_ephemeris.d_AXn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_Xn - gnav_nav_message.gnav_ephemeris.d_Xn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_1 - gnav_nav_message.gnav_ephemeris.d_P_1 < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_t_k - gnav_nav_message.gnav_ephemeris.d_t_k < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_VXn - gnav_nav_message.gnav_ephemeris.d_VXn < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_AXn - gnav_nav_message.gnav_ephemeris.d_AXn < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_Xn - gnav_nav_message.gnav_ephemeris.d_Xn < FLT_EPSILON);
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ TEST(GlonassGnavNavigationMessageTest, String2Decoder)
|
||||
gnav_ephemeris.d_t_b = 8100;
|
||||
gnav_ephemeris.d_VYn = -2.69022750854492;
|
||||
gnav_ephemeris.d_AYn = 0;
|
||||
gnav_ephemeris.d_Yn = -11456.7348632812;
|
||||
gnav_ephemeris.d_Yn = -11456.7348632812;
|
||||
|
||||
// Call target test method
|
||||
gnav_nav_message.flag_ephemeris_str_1 = true;
|
||||
@@ -138,12 +138,12 @@ TEST(GlonassGnavNavigationMessageTest, String2Decoder)
|
||||
gnav_nav_message.string_decoder(str2);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_ephemeris.d_B_n - gnav_nav_message.gnav_ephemeris.d_B_n < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_2 - gnav_nav_message.gnav_ephemeris.d_P_2 < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_t_b - gnav_nav_message.gnav_ephemeris.d_t_b < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_VYn - gnav_nav_message.gnav_ephemeris.d_VYn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_AYn - gnav_nav_message.gnav_ephemeris.d_AYn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_Yn - gnav_nav_message.gnav_ephemeris.d_Yn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_B_n - gnav_nav_message.gnav_ephemeris.d_B_n < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_2 - gnav_nav_message.gnav_ephemeris.d_P_2 < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_t_b - gnav_nav_message.gnav_ephemeris.d_t_b < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_VYn - gnav_nav_message.gnav_ephemeris.d_VYn < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_AYn - gnav_nav_message.gnav_ephemeris.d_AYn < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_Yn - gnav_nav_message.gnav_ephemeris.d_Yn < FLT_EPSILON);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,26 +162,26 @@ TEST(GlonassGnavNavigationMessageTest, String3Decoder)
|
||||
Glonass_Gnav_Ephemeris gnav_ephemeris;
|
||||
|
||||
// Fill out ephemeris values for truth
|
||||
gnav_ephemeris.d_P_3 = 1;
|
||||
gnav_ephemeris.d_gamma_n = 1.81898940354586e-12;
|
||||
gnav_ephemeris.d_P = 3;
|
||||
gnav_ephemeris.d_l3rd_n = 0;
|
||||
gnav_ephemeris.d_VZn = -1.82016849517822;
|
||||
gnav_ephemeris.d_AZn = -2.79396772384644e-09;
|
||||
gnav_ephemeris.d_Zn = 19929.2377929688;
|
||||
gnav_ephemeris.d_P_3 = 1;
|
||||
gnav_ephemeris.d_gamma_n = 1.81898940354586e-12;
|
||||
gnav_ephemeris.d_P = 3;
|
||||
gnav_ephemeris.d_l3rd_n = 0;
|
||||
gnav_ephemeris.d_VZn = -1.82016849517822;
|
||||
gnav_ephemeris.d_AZn = -2.79396772384644e-09;
|
||||
gnav_ephemeris.d_Zn = 19929.2377929688;
|
||||
|
||||
// Call target test method
|
||||
gnav_nav_message.flag_ephemeris_str_2 = true;
|
||||
gnav_nav_message.string_decoder(str3);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_3 - gnav_nav_message.gnav_ephemeris.d_P_3 < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_gamma_n - gnav_nav_message.gnav_ephemeris.d_gamma_n < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P - gnav_nav_message.gnav_ephemeris.d_P < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_l3rd_n - gnav_nav_message.gnav_ephemeris.d_l3rd_n < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_VZn - gnav_nav_message.gnav_ephemeris.d_VZn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_AZn - gnav_nav_message.gnav_ephemeris.d_AZn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_Zn - gnav_nav_message.gnav_ephemeris.d_Zn < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_3 - gnav_nav_message.gnav_ephemeris.d_P_3 < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_gamma_n - gnav_nav_message.gnav_ephemeris.d_gamma_n < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P - gnav_nav_message.gnav_ephemeris.d_P < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_l3rd_n - gnav_nav_message.gnav_ephemeris.d_l3rd_n < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_VZn - gnav_nav_message.gnav_ephemeris.d_VZn < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_AZn - gnav_nav_message.gnav_ephemeris.d_AZn < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_Zn - gnav_nav_message.gnav_ephemeris.d_Zn < FLT_EPSILON);
|
||||
}
|
||||
|
||||
|
||||
@@ -214,14 +214,14 @@ TEST(GlonassGnavNavigationMessageTest, String4Decoder)
|
||||
gnav_nav_message.string_decoder(str4);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_ephemeris.d_tau_n - gnav_nav_message.gnav_ephemeris.d_tau_n < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_Delta_tau_n - gnav_nav_message.gnav_ephemeris.d_Delta_tau_n < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_E_n - gnav_nav_message.gnav_ephemeris.d_E_n < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_4 - gnav_nav_message.gnav_ephemeris.d_P_4 < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_F_T - gnav_nav_message.gnav_ephemeris.d_F_T < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_N_T - gnav_nav_message.gnav_ephemeris.d_N_T < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_n - gnav_nav_message.gnav_ephemeris.d_n < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_M - gnav_nav_message.gnav_ephemeris.d_M < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_ephemeris.d_tau_n - gnav_nav_message.gnav_ephemeris.d_tau_n < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_Delta_tau_n - gnav_nav_message.gnav_ephemeris.d_Delta_tau_n < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_E_n - gnav_nav_message.gnav_ephemeris.d_E_n < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_P_4 - gnav_nav_message.gnav_ephemeris.d_P_4 < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_F_T - gnav_nav_message.gnav_ephemeris.d_F_T < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_N_T - gnav_nav_message.gnav_ephemeris.d_N_T < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_n - gnav_nav_message.gnav_ephemeris.d_n < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_ephemeris.d_M - gnav_nav_message.gnav_ephemeris.d_M < FLT_EPSILON);
|
||||
}
|
||||
|
||||
|
||||
@@ -240,20 +240,20 @@ TEST(GlonassGnavNavigationMessageTest, String5Decoder)
|
||||
Glonass_Gnav_Utc_Model gnav_utc_model;
|
||||
|
||||
// Fill out ephemeris values for truth
|
||||
gnav_utc_model.d_N_A = 268;
|
||||
gnav_utc_model.d_tau_c = 9.6391886472702e-08;
|
||||
gnav_utc_model.d_N_4 = 6;
|
||||
gnav_utc_model.d_tau_gps = 9.313225746154785e-08;
|
||||
gnav_utc_model.d_N_A = 268;
|
||||
gnav_utc_model.d_tau_c = 9.6391886472702e-08;
|
||||
gnav_utc_model.d_N_4 = 6;
|
||||
gnav_utc_model.d_tau_gps = 9.313225746154785e-08;
|
||||
|
||||
// Call target test method
|
||||
gnav_nav_message.flag_ephemeris_str_4 = true;
|
||||
gnav_nav_message.string_decoder(str5);
|
||||
|
||||
// Perform assertions of decoded fields
|
||||
ASSERT_TRUE(gnav_utc_model.d_N_A - gnav_nav_message.gnav_utc_model.d_N_A < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_utc_model.d_tau_c - gnav_nav_message.gnav_utc_model.d_tau_c < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_utc_model.d_N_4 - gnav_nav_message.gnav_utc_model.d_N_4 < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_utc_model.d_tau_gps - gnav_nav_message.gnav_utc_model.d_tau_gps < FLT_EPSILON );
|
||||
ASSERT_TRUE(gnav_utc_model.d_N_A - gnav_nav_message.gnav_utc_model.d_N_A < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_utc_model.d_tau_c - gnav_nav_message.gnav_utc_model.d_tau_c < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_utc_model.d_N_4 - gnav_nav_message.gnav_utc_model.d_N_4 < FLT_EPSILON);
|
||||
ASSERT_TRUE(gnav_utc_model.d_tau_gps - gnav_nav_message.gnav_utc_model.d_tau_gps < FLT_EPSILON);
|
||||
}
|
||||
|
||||
std::string str6("0011010100110100001100111100011100001101011000000110101111001000000101100011111011001");
|
||||
|
||||
Reference in New Issue
Block a user