mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Merging
This commit is contained in:
parent
8035050caa
commit
68fd25a20f
@ -38,59 +38,60 @@
|
|||||||
DEFINE_string(config_file_ptest, std::string(""), "File containing the configuration parameters for the position test.");
|
DEFINE_string(config_file_ptest, std::string(""), "File containing the configuration parameters for the position test.");
|
||||||
|
|
||||||
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||||
//class AcqPerfTest_msg_rx;
|
class AcqPerfTest_msg_rx;
|
||||||
//
|
//
|
||||||
//typedef boost::shared_ptr<AcqPerfTest_msg_rx> AcqPerfTest_msg_rx_sptr;
|
typedef boost::shared_ptr<AcqPerfTest_msg_rx> AcqPerfTest_msg_rx_sptr;
|
||||||
//
|
//
|
||||||
//AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make();
|
AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make();
|
||||||
//
|
//
|
||||||
//class AcqPerfTest_msg_rx : public gr::block
|
class AcqPerfTest_msg_rx : public gr::block
|
||||||
//{
|
{
|
||||||
//private:
|
private:
|
||||||
// friend AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make();
|
friend AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make();
|
||||||
// void msg_handler_events(pmt::pmt_t msg);
|
void msg_handler_events(pmt::pmt_t msg);
|
||||||
// AcqPerfTest_msg_rx();
|
AcqPerfTest_msg_rx();
|
||||||
//
|
|
||||||
//public:
|
public:
|
||||||
// int rx_message;
|
int rx_message;
|
||||||
// ~AcqPerfTest_msg_rx(); //!< Default destructor
|
~AcqPerfTest_msg_rx(); //!< Default destructor
|
||||||
//};
|
};
|
||||||
//
|
|
||||||
//
|
|
||||||
//AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make()
|
AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make()
|
||||||
//{
|
{
|
||||||
// return AcqPerfTest_msg_rx_sptr(new AcqPerfTest_msg_rx());
|
return AcqPerfTest_msg_rx_sptr(new AcqPerfTest_msg_rx());
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//
|
|
||||||
//void AcqPerfTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
void AcqPerfTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||||
//{
|
{
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// long int message = pmt::to_long(msg);
|
long int message = pmt::to_long(msg);
|
||||||
// rx_message = message;
|
rx_message = message;
|
||||||
// }
|
}
|
||||||
// catch (boost::bad_any_cast& e)
|
catch (boost::bad_any_cast& e)
|
||||||
// {
|
{
|
||||||
// LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||||
// rx_message = 0;
|
rx_message = 0;
|
||||||
// }
|
}
|
||||||
//}
|
std::cout << "Received message:" << rx_message << std::endl;
|
||||||
//
|
}
|
||||||
//
|
|
||||||
//AcqPerfTest_msg_rx::AcqPerfTest_msg_rx() : gr::block("AcqPerfTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
|
||||||
//{
|
AcqPerfTest_msg_rx::AcqPerfTest_msg_rx() : gr::block("AcqPerfTest_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(&AcqPerfTest_msg_rx::msg_handler_events, this, _1));
|
this->message_port_register_in(pmt::mp("events"));
|
||||||
// rx_message = 0;
|
this->set_msg_handler(pmt::mp("events"), boost::bind(&AcqPerfTest_msg_rx::msg_handler_events, this, _1));
|
||||||
//}
|
rx_message = 0;
|
||||||
//
|
}
|
||||||
//
|
|
||||||
//AcqPerfTest_msg_rx::~AcqPerfTest_msg_rx()
|
|
||||||
//{
|
AcqPerfTest_msg_rx::~AcqPerfTest_msg_rx()
|
||||||
//}
|
{
|
||||||
//
|
}
|
||||||
//// -----------------------------------------
|
|
||||||
|
// -----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
class AcquisitionPerformanceTest : public ::testing::Test
|
class AcquisitionPerformanceTest : public ::testing::Test
|
||||||
@ -109,8 +110,8 @@ protected:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<double> cn0_ = {41.0, 42.0, 43.0};
|
std::vector<double> cn0_ = {38.0, 40.0, 43.0};
|
||||||
int N_iterations = 2;
|
int N_iterations = 1;
|
||||||
void init();
|
void init();
|
||||||
//void plot_grid();
|
//void plot_grid();
|
||||||
|
|
||||||
@ -118,6 +119,7 @@ protected:
|
|||||||
int generate_signal();
|
int generate_signal();
|
||||||
int configure_receiver(double cn0, unsigned int iter);
|
int configure_receiver(double cn0, unsigned int iter);
|
||||||
int run_receiver();
|
int run_receiver();
|
||||||
|
int run_receiver2();
|
||||||
void check_results();
|
void check_results();
|
||||||
gr::top_block_sptr top_block;
|
gr::top_block_sptr top_block;
|
||||||
Gnss_Synchro gnss_synchro;
|
Gnss_Synchro gnss_synchro;
|
||||||
@ -125,6 +127,7 @@ protected:
|
|||||||
unsigned int doppler_max;
|
unsigned int doppler_max;
|
||||||
unsigned int doppler_step;
|
unsigned int doppler_step;
|
||||||
std::string implementation = "GPS_L1_CA_PCPS_Acquisition";
|
std::string implementation = "GPS_L1_CA_PCPS_Acquisition";
|
||||||
|
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition;
|
||||||
std::shared_ptr<InMemoryConfiguration> config;
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
std::shared_ptr<FileConfiguration> config_f;
|
std::shared_ptr<FileConfiguration> config_f;
|
||||||
|
|
||||||
@ -325,7 +328,7 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, unsigned int iter
|
|||||||
|
|
||||||
config->set_property("Acquisition_1C.max_dwells", std::to_string(1));
|
config->set_property("Acquisition_1C.max_dwells", std::to_string(1));
|
||||||
|
|
||||||
config->set_property("Acquisition_1C.repeat_satellite", "false");
|
config->set_property("Acquisition_1C.repeat_satellite", "true");
|
||||||
|
|
||||||
config->set_property("Acquisition_1C.blocking", "true");
|
config->set_property("Acquisition_1C.blocking", "true");
|
||||||
config->set_property("Acquisition_1C.make_two_steps", "false");
|
config->set_property("Acquisition_1C.make_two_steps", "false");
|
||||||
@ -355,6 +358,9 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, unsigned int iter
|
|||||||
config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(pll_bw_narrow_hz));
|
config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(pll_bw_narrow_hz));
|
||||||
config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(dll_bw_narrow_hz));
|
config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(dll_bw_narrow_hz));
|
||||||
config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_ms));
|
config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_ms));
|
||||||
|
config->set_property("Tracking_1C.cn0_min", std::to_string(50));
|
||||||
|
config->set_property("Tracking_1C.max_lock_fail", std::to_string(1));
|
||||||
|
config->set_property("Tracking_1C.cn0_samples", std::to_string(1));
|
||||||
|
|
||||||
// Set Telemetry
|
// Set Telemetry
|
||||||
config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder");
|
||||||
@ -395,6 +401,58 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, unsigned int iter
|
|||||||
|
|
||||||
|
|
||||||
int AcquisitionPerformanceTest::run_receiver()
|
int AcquisitionPerformanceTest::run_receiver()
|
||||||
|
{
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
std::string file = "./" + filename_raw_data; //+ std::to_string(current_cn0_idx);
|
||||||
|
const char* file_name = file.c_str();
|
||||||
|
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false);
|
||||||
|
|
||||||
|
for (unsigned k = 0; k < 2; k++)
|
||||||
|
{
|
||||||
|
gr::top_block_sptr top_block_ = gr::make_top_block("Acquisition test");
|
||||||
|
boost::shared_ptr<AcqPerfTest_msg_rx> msg_rx = AcqPerfTest_msg_rx_make();
|
||||||
|
|
||||||
|
gnss_synchro = Gnss_Synchro();
|
||||||
|
init();
|
||||||
|
auto acquisition_ = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||||
|
|
||||||
|
//acquisition->connect(top_block);
|
||||||
|
acquisition_->set_gnss_synchro(&gnss_synchro);
|
||||||
|
|
||||||
|
acquisition_->connect(top_block_);
|
||||||
|
acquisition_->set_local_code();
|
||||||
|
acquisition_->set_state(1); // Ensure that acquisition starts at the first sample
|
||||||
|
acquisition_->init();
|
||||||
|
//file_source->seek(static_cast<long>(100 * k), SEEK_SET);
|
||||||
|
|
||||||
|
if (not file_source->seek(static_cast<long>(100 * k), SEEK_SET))
|
||||||
|
{
|
||||||
|
std::cout << "Error skipping " << k << std::endl;
|
||||||
|
}
|
||||||
|
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||||
|
top_block_->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||||
|
top_block_->connect(gr_interleaved_char_to_complex, 0, acquisition_->get_left_block(), 0);
|
||||||
|
top_block_->msg_connect(acquisition_->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
|
|
||||||
|
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block_->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
//file_source->close();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
std::cout << "Acq_delay_samples: " << gnss_synchro.Acq_delay_samples << std::endl;
|
||||||
|
std::cout << "Acq_doppler_hz: " << gnss_synchro.Acq_doppler_hz << std::endl;
|
||||||
|
std::cout << "Acq_samplestamp_samples: " << gnss_synchro.Acq_samplestamp_samples << std::endl
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AcquisitionPerformanceTest::run_receiver2()
|
||||||
{
|
{
|
||||||
std::shared_ptr<ControlThread> control_thread;
|
std::shared_ptr<ControlThread> control_thread;
|
||||||
if (FLAGS_config_file_ptest.empty())
|
if (FLAGS_config_file_ptest.empty())
|
||||||
@ -442,7 +500,7 @@ TEST_F(AcquisitionPerformanceTest, PdvsCn0)
|
|||||||
configure_receiver(*it, iter);
|
configure_receiver(*it, iter);
|
||||||
|
|
||||||
// Run it
|
// Run it
|
||||||
run_receiver();
|
run_receiver2();
|
||||||
|
|
||||||
// Read and store reference data and results
|
// Read and store reference data and results
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,27 @@
|
|||||||
#include "gnuplot_i.h"
|
#include "gnuplot_i.h"
|
||||||
#include "test_flags.h"
|
#include "test_flags.h"
|
||||||
|
|
||||||
DEFINE_bool(plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot");
|
|
||||||
|
// Input signal configuration
|
||||||
|
DEFINE_bool(enable_external_signal_file, false, "Use an external signal file capture instead of the software-defined signal generator");
|
||||||
|
DEFINE_string(signal_file, std::string("gps_l1_capture.dat"), "Path of the external signal capture file");
|
||||||
|
DEFINE_double(CN0_dBHz_start, std::numeric_limits<double>::infinity(), "Enable noise generator and set the CN0 start sweep value [dB-Hz]");
|
||||||
|
DEFINE_double(CN0_dBHz_stop, std::numeric_limits<double>::infinity(), "Enable noise generator and set the CN0 stop sweep value [dB-Hz]");
|
||||||
|
DEFINE_double(CN0_dB_step, 3.0, "Noise generator CN0 sweep step value [dB]");
|
||||||
|
|
||||||
|
DEFINE_double(PLL_bw_hz_start, 40.0, "PLL Wide configuration start sweep value [Hz]");
|
||||||
|
DEFINE_double(PLL_bw_hz_stop, 40.0, "PLL Wide configuration stop sweep value [Hz]");
|
||||||
|
DEFINE_double(PLL_bw_hz_step, 5.0, "PLL Wide configuration sweep step value [Hz]");
|
||||||
|
|
||||||
|
DEFINE_double(DLL_bw_hz_start, 1.5, "DLL Wide configuration start sweep value [Hz]");
|
||||||
|
DEFINE_double(DLL_bw_hz_stop, 1.5, "DLL Wide configuration stop sweep value [Hz]");
|
||||||
|
DEFINE_double(DLL_bw_hz_step, 0.25, "DLL Wide configuration sweep step value [Hz]");
|
||||||
|
|
||||||
|
DEFINE_bool(plot_extra, false, "Enable or disable plots of the correlators output and constellation diagrams");
|
||||||
|
|
||||||
|
//Emulated acquisition configuration
|
||||||
|
|
||||||
|
//Tracking configuration
|
||||||
DEFINE_int32(extend_correlation_symbols, 1, "Set the tracking coherent correlation to N symbols (up to 20 for GPS L1 C/A)");
|
DEFINE_int32(extend_correlation_symbols, 1, "Set the tracking coherent correlation to N symbols (up to 20 for GPS L1 C/A)");
|
||||||
|
|
||||||
//Test output configuration
|
//Test output configuration
|
||||||
@ -137,15 +157,21 @@ public:
|
|||||||
std::vector<double> check_results_doppler(arma::vec& true_time_s,
|
std::vector<double> check_results_doppler(arma::vec& true_time_s,
|
||||||
arma::vec& true_value,
|
arma::vec& true_value,
|
||||||
arma::vec& meas_time_s,
|
arma::vec& meas_time_s,
|
||||||
arma::vec& meas_value);
|
arma::vec& meas_value,
|
||||||
|
double& mean_error,
|
||||||
|
double& std_dev_error);
|
||||||
std::vector<double> check_results_acc_carrier_phase(arma::vec& true_time_s,
|
std::vector<double> check_results_acc_carrier_phase(arma::vec& true_time_s,
|
||||||
arma::vec& true_value,
|
arma::vec& true_value,
|
||||||
arma::vec& meas_time_s,
|
arma::vec& meas_time_s,
|
||||||
arma::vec& meas_value);
|
arma::vec& meas_value,
|
||||||
|
double& mean_error,
|
||||||
|
double& std_dev_error);
|
||||||
std::vector<double> check_results_codephase(arma::vec& true_time_s,
|
std::vector<double> check_results_codephase(arma::vec& true_time_s,
|
||||||
arma::vec& true_value,
|
arma::vec& true_value,
|
||||||
arma::vec& meas_time_s,
|
arma::vec& meas_time_s,
|
||||||
arma::vec& meas_value);
|
arma::vec& meas_value,
|
||||||
|
double& mean_error,
|
||||||
|
double& std_dev_error);
|
||||||
|
|
||||||
GpsL1CADllPllTrackingTest()
|
GpsL1CADllPllTrackingTest()
|
||||||
{
|
{
|
||||||
@ -159,7 +185,11 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void configure_receiver();
|
void configure_receiver(double PLL_wide_bw_hz,
|
||||||
|
double DLL_wide_bw_hz,
|
||||||
|
double PLL_narrow_bw_hz,
|
||||||
|
double DLL_narrow_bw_hz,
|
||||||
|
int extend_correlation_symbols);
|
||||||
|
|
||||||
gr::top_block_sptr top_block;
|
gr::top_block_sptr top_block;
|
||||||
std::shared_ptr<GNSSBlockFactory> factory;
|
std::shared_ptr<GNSSBlockFactory> factory;
|
||||||
@ -214,7 +244,12 @@ int GpsL1CADllPllTrackingTest::generate_signal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GpsL1CADllPllTrackingTest::configure_receiver()
|
void GpsL1CADllPllTrackingTest::configure_receiver(
|
||||||
|
double PLL_wide_bw_hz,
|
||||||
|
double DLL_wide_bw_hz,
|
||||||
|
double PLL_narrow_bw_hz,
|
||||||
|
double DLL_narrow_bw_hz,
|
||||||
|
int extend_correlation_symbols)
|
||||||
{
|
{
|
||||||
gnss_synchro.Channel_ID = 0;
|
gnss_synchro.Channel_ID = 0;
|
||||||
gnss_synchro.System = 'G';
|
gnss_synchro.System = 'G';
|
||||||
@ -222,26 +257,40 @@ void GpsL1CADllPllTrackingTest::configure_receiver()
|
|||||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||||
gnss_synchro.PRN = FLAGS_test_satellite_PRN;
|
gnss_synchro.PRN = FLAGS_test_satellite_PRN;
|
||||||
|
|
||||||
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq));
|
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq));
|
||||||
// Set Tracking
|
// Set Tracking
|
||||||
config->set_property("Tracking_1C.implementation", implementation);
|
config->set_property("Tracking_1C.implementation", implementation);
|
||||||
config->set_property("Tracking_1C.item_type", "gr_complex");
|
config->set_property("Tracking_1C.item_type", "gr_complex");
|
||||||
config->set_property("Tracking_1C.pll_bw_hz", "20.0");
|
config->set_property("Tracking_1C.pll_bw_hz", std::to_string(PLL_wide_bw_hz));
|
||||||
config->set_property("Tracking_1C.dll_bw_hz", "1.5");
|
config->set_property("Tracking_1C.dll_bw_hz", std::to_string(DLL_wide_bw_hz));
|
||||||
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
||||||
config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(FLAGS_extend_correlation_symbols));
|
config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_symbols));
|
||||||
config->set_property("Tracking_1C.pll_bw_narrow_hz", "2.0");
|
config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz));
|
||||||
config->set_property("Tracking_1C.dll_bw_narrow_hz", "1.0");
|
config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz));
|
||||||
config->set_property("Tracking_1C.early_late_space_narrow_chips", "0.5");
|
config->set_property("Tracking_1C.early_late_space_narrow_chips", "0.5");
|
||||||
config->set_property("Tracking_1C.dump", "true");
|
config->set_property("Tracking_1C.dump", "true");
|
||||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||||
|
|
||||||
|
std::cout << "*****************************************\n";
|
||||||
|
std::cout << "*** Tracking configuration parameters ***\n";
|
||||||
|
std::cout << "*****************************************\n";
|
||||||
|
std::cout << "pll_bw_hz: " << config->property("Tracking_1C.pll_bw_hz", 0.0) << " Hz\n";
|
||||||
|
std::cout << "dll_bw_hz: " << config->property("Tracking_1C.dll_bw_hz", 0.0) << " Hz\n";
|
||||||
|
std::cout << "pll_bw_narrow_hz: " << config->property("Tracking_1C.pll_bw_narrow_hz", 0.0) << " Hz\n";
|
||||||
|
std::cout << "dll_bw_narrow_hz: " << config->property("Tracking_1C.dll_bw_narrow_hz", 0.0) << " Hz\n";
|
||||||
|
std::cout << "extend_correlation_symbols: " << config->property("Tracking_1C.extend_correlation_symbols", 0) << " Symbols\n";
|
||||||
|
std::cout << "*****************************************\n";
|
||||||
|
std::cout << "*****************************************\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<double> GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec& true_time_s,
|
std::vector<double> GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec& true_time_s,
|
||||||
arma::vec& true_value,
|
arma::vec& true_value,
|
||||||
arma::vec& meas_time_s,
|
arma::vec& meas_time_s,
|
||||||
arma::vec& meas_value)
|
arma::vec& meas_value,
|
||||||
|
double& mean_error,
|
||||||
|
double& std_dev_error)
|
||||||
{
|
{
|
||||||
// 1. True value interpolation to match the measurement times
|
// 1. True value interpolation to match the measurement times
|
||||||
arma::vec true_value_interp;
|
arma::vec true_value_interp;
|
||||||
@ -269,6 +318,9 @@ std::vector<double> GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec&
|
|||||||
double error_mean = arma::mean(err);
|
double error_mean = arma::mean(err);
|
||||||
double error_var = arma::var(err);
|
double error_var = arma::var(err);
|
||||||
|
|
||||||
|
mean_error = error_mean;
|
||||||
|
std_dev_error = sqrt(error_var);
|
||||||
|
|
||||||
// 4. Peaks
|
// 4. Peaks
|
||||||
double max_error = arma::max(err);
|
double max_error = arma::max(err);
|
||||||
double min_error = arma::min(err);
|
double min_error = arma::min(err);
|
||||||
@ -286,7 +338,9 @@ std::vector<double> GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec&
|
|||||||
std::vector<double> GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec& true_time_s,
|
std::vector<double> GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec& true_time_s,
|
||||||
arma::vec& true_value,
|
arma::vec& true_value,
|
||||||
arma::vec& meas_time_s,
|
arma::vec& meas_time_s,
|
||||||
arma::vec& meas_value)
|
arma::vec& meas_value,
|
||||||
|
double& mean_error,
|
||||||
|
double& std_dev_error)
|
||||||
{
|
{
|
||||||
// 1. True value interpolation to match the measurement times
|
// 1. True value interpolation to match the measurement times
|
||||||
arma::vec true_value_interp;
|
arma::vec true_value_interp;
|
||||||
@ -312,6 +366,8 @@ std::vector<double> GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(a
|
|||||||
double error_mean = arma::mean(err);
|
double error_mean = arma::mean(err);
|
||||||
double error_var = arma::var(err);
|
double error_var = arma::var(err);
|
||||||
|
|
||||||
|
mean_error = error_mean;
|
||||||
|
std_dev_error = sqrt(error_var);
|
||||||
// 4. Peaks
|
// 4. Peaks
|
||||||
double max_error = arma::max(err);
|
double max_error = arma::max(err);
|
||||||
double min_error = arma::min(err);
|
double min_error = arma::min(err);
|
||||||
@ -329,7 +385,9 @@ std::vector<double> GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(a
|
|||||||
std::vector<double> GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec& true_time_s,
|
std::vector<double> GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec& true_time_s,
|
||||||
arma::vec& true_value,
|
arma::vec& true_value,
|
||||||
arma::vec& meas_time_s,
|
arma::vec& meas_time_s,
|
||||||
arma::vec& meas_value)
|
arma::vec& meas_value,
|
||||||
|
double& mean_error,
|
||||||
|
double& std_dev_error)
|
||||||
{
|
{
|
||||||
// 1. True value interpolation to match the measurement times
|
// 1. True value interpolation to match the measurement times
|
||||||
arma::vec true_value_interp;
|
arma::vec true_value_interp;
|
||||||
@ -356,6 +414,9 @@ std::vector<double> GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec
|
|||||||
double error_mean = arma::mean(err);
|
double error_mean = arma::mean(err);
|
||||||
double error_var = arma::var(err);
|
double error_var = arma::var(err);
|
||||||
|
|
||||||
|
mean_error = error_mean;
|
||||||
|
std_dev_error = sqrt(error_var);
|
||||||
|
|
||||||
// 4. Peaks
|
// 4. Peaks
|
||||||
double max_error = arma::max(err);
|
double max_error = arma::max(err);
|
||||||
double min_error = arma::min(err);
|
double min_error = arma::min(err);
|
||||||
@ -378,18 +439,18 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
|
|
||||||
std::vector<double> generator_CN0_values;
|
std::vector<double> generator_CN0_values;
|
||||||
|
|
||||||
std::vector<std::vector<double>> prompt_sweep;
|
|
||||||
std::vector<std::vector<double>> early_sweep;
|
|
||||||
std::vector<std::vector<double>> late_sweep;
|
|
||||||
std::vector<std::vector<double>> promptI_sweep;
|
|
||||||
std::vector<std::vector<double>> promptQ_sweep;
|
|
||||||
std::vector<std::vector<double>> CN0_dBHz_sweep;
|
|
||||||
|
|
||||||
//error vectors
|
//data containers for config param sweep
|
||||||
std::vector<std::vector<double>> doppler_error_sweep;
|
std::vector<std::vector<double>> mean_doppler_error_sweep; //swep config param and cn0 sweep
|
||||||
std::vector<std::vector<double>> code_phase_error_sweep;
|
std::vector<std::vector<double>> std_dev_doppler_error_sweep; //swep config param and cn0 sweep
|
||||||
std::vector<std::vector<double>> acc_carrier_phase_error_sweep;
|
|
||||||
std::vector<std::vector<double>> trk_timestamp_s_sweep;
|
std::vector<std::vector<double>> mean_code_phase_error_sweep; //swep config param and cn0 sweep
|
||||||
|
std::vector<std::vector<double>> std_dev_code_phase_error_sweep; //swep config param and cn0 sweep
|
||||||
|
|
||||||
|
std::vector<std::vector<double>> mean_carrier_phase_error_sweep; //swep config param and cn0 sweep
|
||||||
|
std::vector<std::vector<double>> std_dev_carrier_phase_error_sweep; //swep config param and cn0 sweep
|
||||||
|
|
||||||
|
std::vector<std::vector<double>> trk_valid_timestamp_s_sweep;
|
||||||
|
|
||||||
if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop)
|
if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop)
|
||||||
{
|
{
|
||||||
@ -433,8 +494,67 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//CN0 LOOP
|
// CONFIG PARAM SWEEP LOOP
|
||||||
|
std::vector<double> PLL_wide_bw_values;
|
||||||
|
std::vector<double> DLL_wide_bw_values;
|
||||||
|
|
||||||
|
|
||||||
|
if (FLAGS_PLL_bw_hz_start == FLAGS_PLL_bw_hz_stop)
|
||||||
|
{
|
||||||
|
if (FLAGS_DLL_bw_hz_start == FLAGS_DLL_bw_hz_stop)
|
||||||
|
{
|
||||||
|
//NO PLL/DLL BW sweep
|
||||||
|
PLL_wide_bw_values.push_back(FLAGS_PLL_bw_hz_start);
|
||||||
|
DLL_wide_bw_values.push_back(FLAGS_DLL_bw_hz_start);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//DLL BW Sweep
|
||||||
|
for (double dll_bw = FLAGS_DLL_bw_hz_start; dll_bw > FLAGS_DLL_bw_hz_stop; dll_bw = dll_bw - FLAGS_DLL_bw_hz_step)
|
||||||
|
{
|
||||||
|
PLL_wide_bw_values.push_back(FLAGS_PLL_bw_hz_start);
|
||||||
|
DLL_wide_bw_values.push_back(dll_bw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//PLL BW Sweep
|
||||||
|
for (double pll_bw = FLAGS_PLL_bw_hz_start; pll_bw > FLAGS_PLL_bw_hz_stop; pll_bw = pll_bw - FLAGS_PLL_bw_hz_step)
|
||||||
|
{
|
||||||
|
PLL_wide_bw_values.push_back(pll_bw);
|
||||||
|
DLL_wide_bw_values.push_back(FLAGS_DLL_bw_hz_start);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int config_idx = 0; config_idx < PLL_wide_bw_values.size(); config_idx++)
|
||||||
|
{
|
||||||
|
//CN0 LOOP
|
||||||
|
// data containers for CN0 sweep
|
||||||
|
std::vector<std::vector<double>> prompt_sweep;
|
||||||
|
std::vector<std::vector<double>> early_sweep;
|
||||||
|
std::vector<std::vector<double>> late_sweep;
|
||||||
|
std::vector<std::vector<double>> promptI_sweep;
|
||||||
|
std::vector<std::vector<double>> promptQ_sweep;
|
||||||
|
std::vector<std::vector<double>> CN0_dBHz_sweep;
|
||||||
|
std::vector<std::vector<double>> trk_timestamp_s_sweep;
|
||||||
|
|
||||||
|
std::vector<std::vector<double>> doppler_error_sweep;
|
||||||
|
std::vector<std::vector<double>> code_phase_error_sweep;
|
||||||
|
std::vector<std::vector<double>> acc_carrier_phase_error_sweep;
|
||||||
|
|
||||||
|
std::vector<double> mean_doppler_error;
|
||||||
|
std::vector<double> std_dev_doppler_error;
|
||||||
|
std::vector<double> mean_code_phase_error;
|
||||||
|
std::vector<double> std_dev_code_phase_error;
|
||||||
|
std::vector<double> mean_carrier_phase_error;
|
||||||
|
std::vector<double> std_dev_carrier_phase_error;
|
||||||
|
|
||||||
|
configure_receiver(PLL_wide_bw_values.at(config_idx),
|
||||||
|
DLL_wide_bw_values.at(config_idx),
|
||||||
|
2.0,
|
||||||
|
1.0,
|
||||||
|
FLAGS_extend_correlation_symbols);
|
||||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||||
{
|
{
|
||||||
//******************************************************************************************
|
//******************************************************************************************
|
||||||
@ -465,7 +585,6 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
//***** STEP 4: Configure the signal tracking parameters *****
|
//***** STEP 4: Configure the signal tracking parameters *****
|
||||||
//************************************************************
|
//************************************************************
|
||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
configure_receiver();
|
|
||||||
|
|
||||||
top_block = gr::make_top_block("Tracking test");
|
top_block = gr::make_top_block("Tracking test");
|
||||||
|
|
||||||
@ -533,6 +652,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
|
|
||||||
long int epoch_counter = 0;
|
long int epoch_counter = 0;
|
||||||
|
|
||||||
|
std::vector<double> timestamp_s;
|
||||||
std::vector<double> prompt;
|
std::vector<double> prompt;
|
||||||
std::vector<double> early;
|
std::vector<double> early;
|
||||||
std::vector<double> late;
|
std::vector<double> late;
|
||||||
@ -547,17 +667,18 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
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;
|
trk_prn_delay_chips(epoch_counter) = delay_chips;
|
||||||
epoch_counter++;
|
|
||||||
|
|
||||||
|
|
||||||
|
timestamp_s.push_back(trk_timestamp_s(epoch_counter));
|
||||||
prompt.push_back(trk_dump.abs_P);
|
prompt.push_back(trk_dump.abs_P);
|
||||||
early.push_back(trk_dump.abs_E);
|
early.push_back(trk_dump.abs_E);
|
||||||
late.push_back(trk_dump.abs_L);
|
late.push_back(trk_dump.abs_L);
|
||||||
promptI.push_back(trk_dump.prompt_I);
|
promptI.push_back(trk_dump.prompt_I);
|
||||||
promptQ.push_back(trk_dump.prompt_Q);
|
promptQ.push_back(trk_dump.prompt_Q);
|
||||||
CN0_dBHz.push_back(trk_dump.CN0_SNV_dB_Hz);
|
CN0_dBHz.push_back(trk_dump.CN0_SNV_dB_Hz);
|
||||||
}
|
|
||||||
|
|
||||||
|
epoch_counter++;
|
||||||
|
}
|
||||||
|
trk_timestamp_s_sweep.push_back(timestamp_s);
|
||||||
prompt_sweep.push_back(prompt);
|
prompt_sweep.push_back(prompt);
|
||||||
early_sweep.push_back(early);
|
early_sweep.push_back(early);
|
||||||
late_sweep.push_back(late);
|
late_sweep.push_back(late);
|
||||||
@ -569,6 +690,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
//***** STEP 6: Compare with true values (if available) *****
|
//***** STEP 6: Compare with true values (if available) *****
|
||||||
//***********************************************************
|
//***********************************************************
|
||||||
if (!FLAGS_enable_external_signal_file)
|
if (!FLAGS_enable_external_signal_file)
|
||||||
|
{
|
||||||
|
std::vector<double> doppler_error_hz;
|
||||||
|
std::vector<double> code_phase_error_chips;
|
||||||
|
std::vector<double> acc_carrier_phase_hz;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// load the true values
|
// load the true values
|
||||||
long int n_true_epochs = true_obs_data.num_epochs();
|
long int n_true_epochs = true_obs_data.num_epochs();
|
||||||
@ -592,6 +718,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
}
|
}
|
||||||
// Align initial measurements and cut the tracking pull-in transitory
|
// Align initial measurements and cut the tracking pull-in transitory
|
||||||
double pull_in_offset_s = 1.0;
|
double pull_in_offset_s = 1.0;
|
||||||
|
|
||||||
arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first");
|
arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first");
|
||||||
|
|
||||||
trk_timestamp_s = trk_timestamp_s.subvec(initial_meas_point(0), trk_timestamp_s.size() - 1);
|
trk_timestamp_s = trk_timestamp_s.subvec(initial_meas_point(0), trk_timestamp_s.size() - 1);
|
||||||
@ -599,23 +726,55 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
trk_Doppler_Hz = trk_Doppler_Hz.subvec(initial_meas_point(0), trk_Doppler_Hz.size() - 1);
|
trk_Doppler_Hz = trk_Doppler_Hz.subvec(initial_meas_point(0), trk_Doppler_Hz.size() - 1);
|
||||||
trk_prn_delay_chips = trk_prn_delay_chips.subvec(initial_meas_point(0), trk_prn_delay_chips.size() - 1);
|
trk_prn_delay_chips = trk_prn_delay_chips.subvec(initial_meas_point(0), trk_prn_delay_chips.size() - 1);
|
||||||
|
|
||||||
std::vector<double> doppler_error_hz;
|
|
||||||
std::vector<double> code_phase_error_chips;
|
double mean_error;
|
||||||
std::vector<double> acc_carrier_phase_hz;
|
double std_dev_error;
|
||||||
doppler_error_hz = check_results_doppler(true_timestamp_s, true_Doppler_Hz, trk_timestamp_s, trk_Doppler_Hz);
|
|
||||||
code_phase_error_chips = check_results_codephase(true_timestamp_s, true_prn_delay_chips, trk_timestamp_s, trk_prn_delay_chips);
|
doppler_error_hz = check_results_doppler(true_timestamp_s, true_Doppler_Hz, trk_timestamp_s, trk_Doppler_Hz, mean_error, std_dev_error);
|
||||||
acc_carrier_phase_hz = check_results_acc_carrier_phase(true_timestamp_s, true_acc_carrier_phase_cycles, trk_timestamp_s, trk_acc_carrier_phase_cycles);
|
mean_doppler_error.push_back(mean_error);
|
||||||
|
std_dev_doppler_error.push_back(std_dev_error);
|
||||||
|
|
||||||
|
code_phase_error_chips = check_results_codephase(true_timestamp_s, true_prn_delay_chips, trk_timestamp_s, trk_prn_delay_chips, mean_error, std_dev_error);
|
||||||
|
mean_code_phase_error.push_back(mean_error);
|
||||||
|
std_dev_code_phase_error.push_back(std_dev_error);
|
||||||
|
|
||||||
|
acc_carrier_phase_hz = check_results_acc_carrier_phase(true_timestamp_s, true_acc_carrier_phase_cycles, trk_timestamp_s, trk_acc_carrier_phase_cycles, mean_error, std_dev_error);
|
||||||
|
mean_carrier_phase_error.push_back(mean_error);
|
||||||
|
std_dev_carrier_phase_error.push_back(std_dev_error);
|
||||||
|
|
||||||
//save tracking measurement timestamps to std::vector
|
//save tracking measurement timestamps to std::vector
|
||||||
std::vector<double> vector_trk_timestamp_s(trk_timestamp_s.colptr(0), trk_timestamp_s.colptr(0) + trk_timestamp_s.n_rows);
|
std::vector<double> vector_trk_timestamp_s(trk_timestamp_s.colptr(0), trk_timestamp_s.colptr(0) + trk_timestamp_s.n_rows);
|
||||||
trk_timestamp_s_sweep.push_back(vector_trk_timestamp_s);
|
trk_valid_timestamp_s_sweep.push_back(vector_trk_timestamp_s);
|
||||||
|
|
||||||
doppler_error_sweep.push_back(doppler_error_hz);
|
doppler_error_sweep.push_back(doppler_error_hz);
|
||||||
code_phase_error_sweep.push_back(code_phase_error_chips);
|
code_phase_error_sweep.push_back(code_phase_error_chips);
|
||||||
acc_carrier_phase_error_sweep.push_back(acc_carrier_phase_hz);
|
acc_carrier_phase_error_sweep.push_back(acc_carrier_phase_hz);
|
||||||
}
|
}
|
||||||
|
catch (const std::exception& ex)
|
||||||
|
{
|
||||||
|
std::cout << "Tracking output could not be used, possible loss of lock " << ex.what() << std::endl;
|
||||||
|
|
||||||
|
std::vector<double> vector_trk_timestamp_s;
|
||||||
|
trk_valid_timestamp_s_sweep.push_back(vector_trk_timestamp_s);
|
||||||
|
doppler_error_sweep.push_back(doppler_error_hz);
|
||||||
|
code_phase_error_sweep.push_back(code_phase_error_chips);
|
||||||
|
acc_carrier_phase_error_sweep.push_back(acc_carrier_phase_hz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} //CN0 LOOP
|
} //CN0 LOOP
|
||||||
|
|
||||||
|
if (!FLAGS_enable_external_signal_file)
|
||||||
|
{
|
||||||
|
mean_doppler_error_sweep.push_back(mean_doppler_error);
|
||||||
|
std_dev_doppler_error_sweep.push_back(std_dev_doppler_error);
|
||||||
|
mean_code_phase_error_sweep.push_back(mean_code_phase_error);
|
||||||
|
std_dev_code_phase_error_sweep.push_back(std_dev_code_phase_error);
|
||||||
|
mean_carrier_phase_error_sweep.push_back(mean_carrier_phase_error);
|
||||||
|
std_dev_carrier_phase_error_sweep.push_back(std_dev_carrier_phase_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "A\n\n\n";
|
||||||
//********************************
|
//********************************
|
||||||
//***** STEP 7: Plot results *****
|
//***** STEP 7: Plot results *****
|
||||||
//********************************
|
//********************************
|
||||||
@ -636,75 +795,87 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
boost::filesystem::path dir = p.parent_path();
|
boost::filesystem::path dir = p.parent_path();
|
||||||
std::string gnuplot_path = dir.native();
|
std::string gnuplot_path = dir.native();
|
||||||
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||||
std::vector<double> timevec;
|
|
||||||
unsigned int decimate = static_cast<unsigned int>(FLAGS_plot_decimate);
|
unsigned int decimate = static_cast<unsigned int>(FLAGS_plot_decimate);
|
||||||
|
|
||||||
|
if (FLAGS_plot_extra)
|
||||||
|
{
|
||||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||||
{
|
{
|
||||||
timevec.clear();
|
|
||||||
//todo: timevector MUST BE READED from the trk output file
|
|
||||||
double t = 0.0;
|
|
||||||
for (auto it = prompt_sweep.at(current_cn0_idx).begin(); it != prompt_sweep.at(current_cn0_idx).end(); it++)
|
|
||||||
{
|
|
||||||
timevec.push_back(t);
|
|
||||||
t = t + GPS_L1_CA_CODE_PERIOD;
|
|
||||||
}
|
|
||||||
Gnuplot g1("linespoints");
|
Gnuplot g1("linespoints");
|
||||||
g1.set_title("[" + std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz ] GPS L1 C/A signal tracking correlators' output (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
g1.showonscreen(); // window output
|
||||||
|
g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
g1.set_grid();
|
g1.set_grid();
|
||||||
g1.set_xlabel("Time [s]");
|
g1.set_xlabel("Time [s]");
|
||||||
g1.set_ylabel("Correlators' output");
|
g1.set_ylabel("Correlators' output");
|
||||||
g1.cmd("set key box opaque");
|
//g1.cmd("set key box opaque");
|
||||||
g1.plot_xy(timevec, prompt_sweep.at(current_cn0_idx), "Prompt", decimate);
|
g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), prompt_sweep.at(current_cn0_idx), "Prompt", decimate);
|
||||||
g1.plot_xy(timevec, early_sweep.at(current_cn0_idx), "Early", decimate);
|
g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), early_sweep.at(current_cn0_idx), "Early", decimate);
|
||||||
g1.plot_xy(timevec, late_sweep.at(current_cn0_idx), "Late", decimate);
|
g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), late_sweep.at(current_cn0_idx), "Late", decimate);
|
||||||
g1.savetops("Correlators_outputs");
|
g1.set_legend();
|
||||||
g1.savetopdf("Correlators_outputs", 18);
|
g1.savetops("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)));
|
||||||
g1.showonscreen(); // window output
|
g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18);
|
||||||
|
}
|
||||||
Gnuplot g2("points");
|
Gnuplot g2("points");
|
||||||
g2.set_title("[" + std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz ] Constellation diagram (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
g2.showonscreen(); // window output
|
||||||
|
g2.set_multiplot(ceil(static_cast<float>(generator_CN0_values.size()) / 2.0),
|
||||||
|
ceil(static_cast<float>(generator_CN0_values.size()) / 2));
|
||||||
|
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||||
|
{
|
||||||
|
g2.reset_plot();
|
||||||
|
g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
g2.set_grid();
|
g2.set_grid();
|
||||||
g2.set_xlabel("Inphase");
|
g2.set_xlabel("Inphase");
|
||||||
g2.set_ylabel("Quadrature");
|
g2.set_ylabel("Quadrature");
|
||||||
g2.cmd("set size ratio -1");
|
//g2.cmd("set size ratio -1");
|
||||||
g2.plot_xy(promptI_sweep.at(current_cn0_idx), promptQ_sweep.at(current_cn0_idx));
|
g2.plot_xy(promptI_sweep.at(current_cn0_idx), promptQ_sweep.at(current_cn0_idx));
|
||||||
|
}
|
||||||
|
g2.unset_multiplot();
|
||||||
g2.savetops("Constellation");
|
g2.savetops("Constellation");
|
||||||
g2.savetopdf("Constellation", 18);
|
g2.savetopdf("Constellation", 18);
|
||||||
g2.showonscreen(); // window output
|
|
||||||
}
|
|
||||||
Gnuplot g3("linespoints");
|
Gnuplot g3("linespoints");
|
||||||
g3.set_title("GPS L1 C/A tracking CN0 output (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
g3.set_title("GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
g3.set_grid();
|
g3.set_grid();
|
||||||
g3.set_xlabel("Time [s]");
|
g3.set_xlabel("Time [s]");
|
||||||
g3.set_ylabel("Reported CN0 [dB-Hz]");
|
g3.set_ylabel("Reported CN0 [dB-Hz]");
|
||||||
g3.cmd("set key box opaque");
|
g3.cmd("set key box opaque");
|
||||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||||
{
|
{
|
||||||
g3.plot_xy(timevec, CN0_dBHz_sweep.at(current_cn0_idx),
|
g3.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), CN0_dBHz_sweep.at(current_cn0_idx),
|
||||||
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
||||||
}
|
}
|
||||||
g3.set_legend();
|
g3.set_legend();
|
||||||
g3.savetops("CN0_output");
|
g3.savetops("CN0_output");
|
||||||
g3.savetopdf("CN0_output", 18);
|
g3.savetopdf("CN0_output", 18);
|
||||||
g3.showonscreen(); // window output
|
g3.showonscreen(); // window output
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "B\n\n\n";
|
||||||
|
//PLOT ERROR FIGURES (only if it is used the signal generator)
|
||||||
|
if (!FLAGS_enable_external_signal_file)
|
||||||
|
{
|
||||||
Gnuplot g4("points");
|
Gnuplot g4("points");
|
||||||
g4.set_title("Doppler error (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
g4.showonscreen(); // window output
|
||||||
g4.set_grid();
|
g4.set_multiplot(ceil(static_cast<float>(generator_CN0_values.size()) / 2.0),
|
||||||
g4.set_xlabel("Time [s]");
|
ceil(static_cast<float>(generator_CN0_values.size()) / 2));
|
||||||
g4.set_ylabel("Dopper error [Hz]");
|
|
||||||
g4.cmd("set key box opaque");
|
|
||||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||||
{
|
{
|
||||||
g4.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), doppler_error_sweep.at(current_cn0_idx),
|
g4.reset_plot();
|
||||||
|
g4.set_title(std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz] Doppler error " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
|
g4.set_grid();
|
||||||
|
//g4.cmd("set key box opaque");
|
||||||
|
g4.set_xlabel("Time [s]");
|
||||||
|
g4.set_ylabel("Dopper error [Hz]");
|
||||||
|
g4.plot_xy(trk_valid_timestamp_s_sweep.at(current_cn0_idx), doppler_error_sweep.at(current_cn0_idx),
|
||||||
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
||||||
|
//g4.set_legend();
|
||||||
}
|
}
|
||||||
g4.set_legend();
|
g4.unset_multiplot();
|
||||||
g4.savetops("Doppler_error_output");
|
g4.savetops("Doppler_error_output");
|
||||||
g4.savetopdf("Doppler_error_output", 18);
|
g4.savetopdf("Doppler_error_output", 18);
|
||||||
g4.showonscreen(); // window output
|
|
||||||
|
|
||||||
Gnuplot g5("points");
|
Gnuplot g5("points");
|
||||||
g5.set_title("Code delay error (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
g5.set_grid();
|
g5.set_grid();
|
||||||
g5.set_xlabel("Time [s]");
|
g5.set_xlabel("Time [s]");
|
||||||
g5.set_ylabel("Code delay error [Chips]");
|
g5.set_ylabel("Code delay error [Chips]");
|
||||||
@ -712,7 +883,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
|
|
||||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||||
{
|
{
|
||||||
g5.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), code_phase_error_sweep.at(current_cn0_idx),
|
g5.plot_xy(trk_valid_timestamp_s_sweep.at(current_cn0_idx), code_phase_error_sweep.at(current_cn0_idx),
|
||||||
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
||||||
}
|
}
|
||||||
g5.set_legend();
|
g5.set_legend();
|
||||||
@ -721,7 +892,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
g5.showonscreen(); // window output
|
g5.showonscreen(); // window output
|
||||||
|
|
||||||
Gnuplot g6("points");
|
Gnuplot g6("points");
|
||||||
g6.set_title("Accumulated carrier phase error (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
g6.set_grid();
|
g6.set_grid();
|
||||||
g6.set_xlabel("Time [s]");
|
g6.set_xlabel("Time [s]");
|
||||||
g6.set_ylabel("Accumulated carrier phase error [Cycles]");
|
g6.set_ylabel("Accumulated carrier phase error [Cycles]");
|
||||||
@ -729,7 +900,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
|
|
||||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||||
{
|
{
|
||||||
g6.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), acc_carrier_phase_error_sweep.at(current_cn0_idx),
|
g6.plot_xy(trk_valid_timestamp_s_sweep.at(current_cn0_idx), acc_carrier_phase_error_sweep.at(current_cn0_idx),
|
||||||
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
||||||
}
|
}
|
||||||
g6.set_legend();
|
g6.set_legend();
|
||||||
@ -737,6 +908,91 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
g6.savetopdf("Carrier_phase_error_output", 18);
|
g6.savetopdf("Carrier_phase_error_output", 18);
|
||||||
g6.showonscreen(); // window output
|
g6.showonscreen(); // window output
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (const GnuplotException& ge)
|
||||||
|
{
|
||||||
|
std::cout << ge.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (FLAGS_plot_gps_l1_tracking_test == true)
|
||||||
|
{
|
||||||
|
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||||
|
if (gnuplot_executable.empty())
|
||||||
|
{
|
||||||
|
std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE," << std::endl;
|
||||||
|
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||||
|
std::cout << "Test results will not be plotted." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (generator_CN0_values.size() > 1)
|
||||||
|
{
|
||||||
|
//plot metrics
|
||||||
|
|
||||||
|
Gnuplot g7("linespoints");
|
||||||
|
g7.set_title("Doppler error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
|
g7.set_grid();
|
||||||
|
g7.set_xlabel("CN0 [dB-Hz]");
|
||||||
|
g7.set_ylabel("Doppler error [Hz]");
|
||||||
|
g7.set_pointsize(2);
|
||||||
|
g7.cmd("set termoption lw 2");
|
||||||
|
g7.cmd("set key box opaque");
|
||||||
|
for (int config_sweep_idx = 0; config_sweep_idx < mean_doppler_error_sweep.size(); config_sweep_idx++)
|
||||||
|
{
|
||||||
|
g7.plot_xy_err(generator_CN0_values,
|
||||||
|
mean_doppler_error_sweep.at(config_sweep_idx),
|
||||||
|
std_dev_doppler_error_sweep.at(config_sweep_idx),
|
||||||
|
"PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_sweep_idx)) +
|
||||||
|
+"," + std::to_string(DLL_wide_bw_values.at(config_sweep_idx)) + " Hz");
|
||||||
|
}
|
||||||
|
g7.savetops("Doppler_error_metrics");
|
||||||
|
g7.savetopdf("Doppler_error_metrics", 18);
|
||||||
|
|
||||||
|
Gnuplot g8("linespoints");
|
||||||
|
g8.set_title("Accumulated carrier phase error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
|
g8.set_grid();
|
||||||
|
g8.set_xlabel("CN0 [dB-Hz]");
|
||||||
|
g8.set_ylabel("Accumulated Carrier Phase error [Cycles]");
|
||||||
|
g8.cmd("set key box opaque");
|
||||||
|
g8.cmd("set termoption lw 2");
|
||||||
|
g8.set_pointsize(2);
|
||||||
|
for (int config_sweep_idx = 0; config_sweep_idx < mean_doppler_error_sweep.size(); config_sweep_idx++)
|
||||||
|
{
|
||||||
|
g8.plot_xy_err(generator_CN0_values,
|
||||||
|
mean_carrier_phase_error_sweep.at(config_sweep_idx),
|
||||||
|
std_dev_carrier_phase_error_sweep.at(config_sweep_idx),
|
||||||
|
"PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_sweep_idx)) +
|
||||||
|
+"," + std::to_string(DLL_wide_bw_values.at(config_sweep_idx)) + " Hz");
|
||||||
|
}
|
||||||
|
g8.savetops("Carrier_error_metrics");
|
||||||
|
g8.savetopdf("Carrier_error_metrics", 18);
|
||||||
|
|
||||||
|
Gnuplot g9("linespoints");
|
||||||
|
g9.set_title("Code Phase error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
|
g9.set_grid();
|
||||||
|
g9.set_xlabel("CN0 [dB-Hz]");
|
||||||
|
g9.set_ylabel("Code Phase error [Chips]");
|
||||||
|
g9.cmd("set key box opaque");
|
||||||
|
g9.cmd("set termoption lw 2");
|
||||||
|
g9.set_pointsize(2);
|
||||||
|
for (int config_sweep_idx = 0; config_sweep_idx < mean_doppler_error_sweep.size(); config_sweep_idx++)
|
||||||
|
{
|
||||||
|
g9.plot_xy_err(generator_CN0_values,
|
||||||
|
mean_code_phase_error_sweep.at(config_sweep_idx),
|
||||||
|
std_dev_code_phase_error_sweep.at(config_sweep_idx),
|
||||||
|
"PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_sweep_idx)) +
|
||||||
|
+"," + std::to_string(DLL_wide_bw_values.at(config_sweep_idx)) + " Hz");
|
||||||
|
}
|
||||||
|
g9.savetops("Code_error_metrics");
|
||||||
|
g9.savetopdf("Code_error_metrics", 18);
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (const GnuplotException& ge)
|
catch (const GnuplotException& ge)
|
||||||
{
|
{
|
||||||
std::cout << ge.what() << std::endl;
|
std::cout << ge.what() << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user