mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into acq_performance
This commit is contained in:
commit
a43f691597
@ -121,6 +121,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
|
||||
}
|
||||
grid_ = arma::fmat();
|
||||
d_step_two = false;
|
||||
d_dump_number = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -335,46 +336,47 @@ void pcps_acquisition::send_negative_acquisition()
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition::dump_results(unsigned int doppler_index, int effective_fft_size)
|
||||
void pcps_acquisition::dump_results(int effective_fft_size)
|
||||
{
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
||||
if (doppler_index == (d_num_doppler_bins - 1))
|
||||
d_dump_number++;
|
||||
std::string filename = acq_parameters.dump_filename;
|
||||
filename.append("_");
|
||||
filename.append(1, d_gnss_synchro->System);
|
||||
filename.append("_");
|
||||
filename.append(1, d_gnss_synchro->Signal[0]);
|
||||
filename.append(1, d_gnss_synchro->Signal[1]);
|
||||
filename.append("_ch_");
|
||||
filename.append(std::to_string(d_channel));
|
||||
filename.append("_");
|
||||
filename.append(std::to_string(d_dump_number));
|
||||
filename.append("_sat_");
|
||||
filename.append(std::to_string(d_gnss_synchro->PRN));
|
||||
filename.append(".mat");
|
||||
|
||||
mat_t* matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if (matfp == NULL)
|
||||
{
|
||||
std::string filename = acq_parameters.dump_filename;
|
||||
filename.append("_");
|
||||
filename.append(1, d_gnss_synchro->System);
|
||||
filename.append("_");
|
||||
filename.append(1, d_gnss_synchro->Signal[0]);
|
||||
filename.append(1, d_gnss_synchro->Signal[1]);
|
||||
filename.append("_sat_");
|
||||
filename.append(std::to_string(d_gnss_synchro->PRN));
|
||||
filename.append(".mat");
|
||||
std::cout << "Unable to create or open Acquisition dump file" << std::endl;
|
||||
acq_parameters.dump = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t dims[2] = {static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)};
|
||||
matvar_t* matvar = Mat_VarCreate("grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
mat_t* matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73);
|
||||
if (matfp == NULL)
|
||||
{
|
||||
std::cout << "Unable to create or open Acquisition dump file" << std::endl;
|
||||
acq_parameters.dump = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t dims[2] = {static_cast<size_t>(effective_fft_size), static_cast<size_t>(d_num_doppler_bins)};
|
||||
matvar_t* matvar = Mat_VarCreate("grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
dims[0] = static_cast<size_t>(1);
|
||||
dims[1] = static_cast<size_t>(1);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &acq_parameters.doppler_max, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
dims[0] = static_cast<size_t>(1);
|
||||
dims[1] = static_cast<size_t>(1);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &acq_parameters.doppler_max, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_doppler_step, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_doppler_step, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
Mat_Close(matfp);
|
||||
}
|
||||
Mat_Close(matfp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,7 +388,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
// initialize acquisition algorithm
|
||||
uint32_t indext = 0;
|
||||
float magt = 0.0;
|
||||
const gr_complex* in = d_data_buffer; //Get the input samples pointer
|
||||
const gr_complex* in = d_data_buffer; // Get the input samples pointer
|
||||
int effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
|
||||
if (d_cshort)
|
||||
{
|
||||
@ -479,7 +481,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump)
|
||||
{
|
||||
pcps_acquisition::dump_results(doppler_index, effective_fft_size);
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -548,10 +550,15 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump)
|
||||
{
|
||||
pcps_acquisition::dump_results(doppler_index, effective_fft_size);
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump)
|
||||
{
|
||||
pcps_acquisition::dump_results(effective_fft_size);
|
||||
}
|
||||
lk.lock();
|
||||
if (!acq_parameters.bit_transition_flag)
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ private:
|
||||
|
||||
void send_positive_acquisition();
|
||||
|
||||
void dump_results(unsigned int doppler_index, int effective_fft_size);
|
||||
void dump_results(int effective_fft_size);
|
||||
|
||||
Acq_Conf acq_parameters;
|
||||
bool d_active;
|
||||
@ -123,6 +123,7 @@ private:
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
arma::fmat grid_;
|
||||
long int d_dump_number;
|
||||
|
||||
public:
|
||||
~pcps_acquisition();
|
||||
|
@ -69,7 +69,7 @@
|
||||
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
|
||||
//all UNIX-like OSs (Linux, *BSD, MacOSX, Solaris, ...)
|
||||
#include <unistd.h> // for access(), mkstemp()
|
||||
#define GP_MAX_TMP_FILES 64
|
||||
#define GP_MAX_TMP_FILES 1024
|
||||
#else
|
||||
#error unsupported or unknown operating system
|
||||
#endif
|
||||
@ -302,9 +302,9 @@ public:
|
||||
///
|
||||
/// \return <-- reference to the gnuplot object
|
||||
// -----------------------------------------------
|
||||
inline Gnuplot &set_multiplot()
|
||||
inline Gnuplot &set_multiplot(int rows, int cols)
|
||||
{
|
||||
cmd("set multiplot");
|
||||
cmd("set multiplot layout " + std::to_string(rows) + "," + std::to_string(cols)); //+ " rowfirst");
|
||||
return *this;
|
||||
};
|
||||
|
||||
@ -1906,11 +1906,11 @@ void Gnuplot::init()
|
||||
std::string tmp = Gnuplot::m_sGNUPlotPath + "/" +
|
||||
Gnuplot::m_sGNUPlotFileName;
|
||||
|
||||
// FILE *popen(const char *command, const char *mode);
|
||||
// The popen() function shall execute the command specified by the string
|
||||
// command, create a pipe between the calling program and the executed
|
||||
// command, and return a pointer to a stream that can be used to either read
|
||||
// from or write to the pipe.
|
||||
// FILE *popen(const char *command, const char *mode);
|
||||
// The popen() function shall execute the command specified by the string
|
||||
// command, create a pipe between the calling program and the executed
|
||||
// command, and return a pointer to a stream that can be used to either read
|
||||
// from or write to the pipe.
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
||||
gnucmd = _popen(tmp.c_str(), "w");
|
||||
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
|
||||
@ -1974,7 +1974,7 @@ bool Gnuplot::get_program_path()
|
||||
|
||||
std::list<std::string> ls;
|
||||
|
||||
//split path (one long string) into list ls of strings
|
||||
//split path (one long string) into list ls of strings
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
||||
stringtok(ls, path_str, ";");
|
||||
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
|
||||
@ -2018,16 +2018,16 @@ bool Gnuplot::file_exists(const std::string &filename, int mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
// int _access(const char *path, int mode);
|
||||
// returns 0 if the file has the given mode,
|
||||
// it returns -1 if the named file does not exist or is not accessible in
|
||||
// the given mode
|
||||
// mode = 0 (F_OK) (default): checks file for existence only
|
||||
// mode = 1 (X_OK): execution permission
|
||||
// mode = 2 (W_OK): write permission
|
||||
// mode = 4 (R_OK): read permission
|
||||
// mode = 6 : read and write permission
|
||||
// mode = 7 : read, write and execution permission
|
||||
// int _access(const char *path, int mode);
|
||||
// returns 0 if the file has the given mode,
|
||||
// it returns -1 if the named file does not exist or is not accessible in
|
||||
// the given mode
|
||||
// mode = 0 (F_OK) (default): checks file for existence only
|
||||
// mode = 1 (X_OK): execution permission
|
||||
// mode = 2 (W_OK): write permission
|
||||
// mode = 4 (R_OK): read permission
|
||||
// mode = 6 : read and write permission
|
||||
// mode = 7 : read, write and execution permission
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
||||
if (_access(filename.c_str(), mode) == 0)
|
||||
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
|
||||
@ -2089,19 +2089,19 @@ std::string Gnuplot::create_tmpfile(std::ofstream &tmp)
|
||||
throw GnuplotException(except.str());
|
||||
}
|
||||
|
||||
// int mkstemp(char *name);
|
||||
// shall replace the contents of the string pointed to by "name" by a unique
|
||||
// filename, and return a file descriptor for the file open for reading and
|
||||
// writing. Otherwise, -1 shall be returned if no suitable file could be
|
||||
// created. The string in template should look like a filename with six
|
||||
// trailing 'X' s; mkstemp() replaces each 'X' with a character from the
|
||||
// portable filename character set. The characters are chosen such that the
|
||||
// resulting name does not duplicate the name of an existing file at the
|
||||
// time of a call to mkstemp()
|
||||
// int mkstemp(char *name);
|
||||
// shall replace the contents of the string pointed to by "name" by a unique
|
||||
// filename, and return a file descriptor for the file open for reading and
|
||||
// writing. Otherwise, -1 shall be returned if no suitable file could be
|
||||
// created. The string in template should look like a filename with six
|
||||
// trailing 'X' s; mkstemp() replaces each 'X' with a character from the
|
||||
// portable filename character set. The characters are chosen such that the
|
||||
// resulting name does not duplicate the name of an existing file at the
|
||||
// time of a call to mkstemp()
|
||||
|
||||
//
|
||||
// open temporary files for output
|
||||
//
|
||||
//
|
||||
// open temporary files for output
|
||||
//
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
||||
if (_mktemp(name) == NULL)
|
||||
|
@ -73,6 +73,7 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
Mat_Close(matfile);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::vector<float> >::iterator it1;
|
||||
std::vector<float>::iterator it2;
|
||||
float* aux = static_cast<float*>(var_->data);
|
||||
@ -93,7 +94,13 @@ 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,
|
||||
int channel,
|
||||
int execution)
|
||||
{
|
||||
d_basename = basename;
|
||||
d_sat = sat;
|
||||
@ -103,7 +110,7 @@ acquisition_dump_reader::acquisition_dump_reader(const std::string& basename, un
|
||||
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";
|
||||
d_dump_filename = d_basename + "_ch_" + std::to_string(channel) + "_" + std::to_string(execution) + "_sat_" + std::to_string(d_sat) + ".mat";
|
||||
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||
{
|
||||
doppler.push_back(-static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index);
|
||||
|
@ -38,7 +38,13 @@
|
||||
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,
|
||||
int channel = 0,
|
||||
int execution = 1);
|
||||
~acquisition_dump_reader();
|
||||
bool read_binary_acq();
|
||||
|
||||
|
@ -61,6 +61,15 @@ DEFINE_double(CN0_dBHz_start, std::numeric_limits<double>::infinity(), "Enable n
|
||||
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
|
||||
|
||||
@ -148,15 +157,21 @@ public:
|
||||
std::vector<double> check_results_doppler(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
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,
|
||||
arma::vec& true_value,
|
||||
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,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
arma::vec& meas_value);
|
||||
arma::vec& meas_value,
|
||||
double& mean_error,
|
||||
double& std_dev_error);
|
||||
|
||||
GpsL1CADllPllTrackingTest()
|
||||
{
|
||||
@ -170,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;
|
||||
std::shared_ptr<GNSSBlockFactory> factory;
|
||||
@ -225,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.System = 'G';
|
||||
@ -233,26 +257,40 @@ void GpsL1CADllPllTrackingTest::configure_receiver()
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
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));
|
||||
// Set Tracking
|
||||
config->set_property("Tracking_1C.implementation", implementation);
|
||||
config->set_property("Tracking_1C.item_type", "gr_complex");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", "20.0");
|
||||
config->set_property("Tracking_1C.dll_bw_hz", "1.5");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", std::to_string(PLL_wide_bw_hz));
|
||||
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.extend_correlation_symbols", std::to_string(FLAGS_extend_correlation_symbols));
|
||||
config->set_property("Tracking_1C.pll_bw_narrow_hz", "2.0");
|
||||
config->set_property("Tracking_1C.dll_bw_narrow_hz", "1.0");
|
||||
config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_symbols));
|
||||
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", std::to_string(DLL_narrow_bw_hz));
|
||||
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_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,
|
||||
arma::vec& true_value,
|
||||
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
|
||||
arma::vec true_value_interp;
|
||||
@ -280,6 +318,9 @@ std::vector<double> GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec&
|
||||
double error_mean = arma::mean(err);
|
||||
double error_var = arma::var(err);
|
||||
|
||||
mean_error = error_mean;
|
||||
std_dev_error = sqrt(error_var);
|
||||
|
||||
// 4. Peaks
|
||||
double max_error = arma::max(err);
|
||||
double min_error = arma::min(err);
|
||||
@ -297,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,
|
||||
arma::vec& true_value,
|
||||
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
|
||||
arma::vec true_value_interp;
|
||||
@ -323,6 +366,8 @@ std::vector<double> GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(a
|
||||
double error_mean = arma::mean(err);
|
||||
double error_var = arma::var(err);
|
||||
|
||||
mean_error = error_mean;
|
||||
std_dev_error = sqrt(error_var);
|
||||
// 4. Peaks
|
||||
double max_error = arma::max(err);
|
||||
double min_error = arma::min(err);
|
||||
@ -340,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,
|
||||
arma::vec& true_value,
|
||||
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
|
||||
arma::vec true_value_interp;
|
||||
@ -367,6 +414,9 @@ std::vector<double> GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec
|
||||
double error_mean = arma::mean(err);
|
||||
double error_var = arma::var(err);
|
||||
|
||||
mean_error = error_mean;
|
||||
std_dev_error = sqrt(error_var);
|
||||
|
||||
// 4. Peaks
|
||||
double max_error = arma::max(err);
|
||||
double min_error = arma::min(err);
|
||||
@ -389,18 +439,18 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
|
||||
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
|
||||
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<std::vector<double>> trk_timestamp_s_sweep;
|
||||
//data containers for config param sweep
|
||||
std::vector<std::vector<double>> mean_doppler_error_sweep; //swep config param and cn0 sweep
|
||||
std::vector<std::vector<double>> std_dev_doppler_error_sweep; //swep config param and cn0 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)
|
||||
{
|
||||
@ -444,192 +494,430 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
}
|
||||
|
||||
|
||||
//CN0 LOOP
|
||||
// CONFIG PARAM SWEEP LOOP
|
||||
std::vector<double> PLL_wide_bw_values;
|
||||
std::vector<double> DLL_wide_bw_values;
|
||||
|
||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||
|
||||
if (FLAGS_PLL_bw_hz_start == FLAGS_PLL_bw_hz_stop)
|
||||
{
|
||||
//******************************************************************************************
|
||||
//***** Obtain the initial signal sinchronization parameters (emulating an acquisition) ****
|
||||
//******************************************************************************************
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
if (FLAGS_DLL_bw_hz_start == FLAGS_DLL_bw_hz_stop)
|
||||
{
|
||||
test_satellite_PRN = FLAGS_test_satellite_PRN;
|
||||
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");
|
||||
true_obs_data.close_obs_file();
|
||||
ASSERT_EQ(true_obs_data.open_obs_file(true_obs_file), true) << "Failure opening true observables file";
|
||||
// load acquisition data based on the first epoch of the true observations
|
||||
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?";
|
||||
std::cout << "Testing satellite PRN=" << test_satellite_PRN << std::endl;
|
||||
std::cout << "Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << std::endl;
|
||||
acq_doppler_hz = true_obs_data.doppler_l1_hz;
|
||||
acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) * static_cast<double>(baseband_sampling_freq) * GPS_L1_CA_CODE_PERIOD;
|
||||
// restart the epoch counter
|
||||
true_obs_data.restart();
|
||||
//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);
|
||||
}
|
||||
|
||||
|
||||
//***** STEP 4: Configure the signal tracking parameters *****
|
||||
//************************************************************
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
configure_receiver();
|
||||
|
||||
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_);
|
||||
|
||||
boost::shared_ptr<GpsL1CADllPllTrackingTest_msg_rx> msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make();
|
||||
|
||||
gnss_synchro.Acq_delay_samples = acq_delay_samples;
|
||||
gnss_synchro.Acq_doppler_hz = acq_doppler_hz;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
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);
|
||||
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);
|
||||
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of tracking test.";
|
||||
|
||||
|
||||
//********************************************************************
|
||||
//***** STEP 5: Perform the signal tracking and read the results *****
|
||||
//********************************************************************
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "Signal tracking completed in " << elapsed_seconds.count() << " seconds" << std::endl;
|
||||
|
||||
//check results
|
||||
//load the measured values
|
||||
tracking_dump_reader trk_dump;
|
||||
ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true)
|
||||
<< "Failure opening tracking dump file";
|
||||
|
||||
long int n_measured_epochs = trk_dump.num_epochs();
|
||||
std::cout << "Measured observation epochs=" << n_measured_epochs << std::endl;
|
||||
|
||||
arma::vec trk_timestamp_s = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_acc_carrier_phase_cycles = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_Doppler_Hz = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_prn_delay_chips = arma::zeros(n_measured_epochs, 1);
|
||||
|
||||
long int epoch_counter = 0;
|
||||
|
||||
std::vector<double> prompt;
|
||||
std::vector<double> early;
|
||||
std::vector<double> late;
|
||||
std::vector<double> promptI;
|
||||
std::vector<double> promptQ;
|
||||
std::vector<double> CN0_dBHz;
|
||||
while (trk_dump.read_binary_obs())
|
||||
else
|
||||
{
|
||||
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);
|
||||
|
||||
trk_prn_delay_chips(epoch_counter) = delay_chips;
|
||||
epoch_counter++;
|
||||
|
||||
|
||||
prompt.push_back(trk_dump.abs_P);
|
||||
early.push_back(trk_dump.abs_E);
|
||||
late.push_back(trk_dump.abs_L);
|
||||
promptI.push_back(trk_dump.prompt_I);
|
||||
promptQ.push_back(trk_dump.prompt_Q);
|
||||
CN0_dBHz.push_back(trk_dump.CN0_SNV_dB_Hz);
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
prompt_sweep.push_back(prompt);
|
||||
early_sweep.push_back(early);
|
||||
late_sweep.push_back(late);
|
||||
promptI_sweep.push_back(promptI);
|
||||
promptQ_sweep.push_back(promptQ);
|
||||
CN0_dBHz_sweep.push_back(CN0_dBHz);
|
||||
|
||||
//***********************************************************
|
||||
//***** STEP 6: Compare with true values (if available) *****
|
||||
//***********************************************************
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
}
|
||||
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)
|
||||
{
|
||||
// load the true values
|
||||
long int n_true_epochs = true_obs_data.num_epochs();
|
||||
std::cout << "True observation epochs=" << n_true_epochs << std::endl;
|
||||
PLL_wide_bw_values.push_back(pll_bw);
|
||||
DLL_wide_bw_values.push_back(FLAGS_DLL_bw_hz_start);
|
||||
}
|
||||
}
|
||||
|
||||
arma::vec true_timestamp_s = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_acc_carrier_phase_cycles = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_Doppler_Hz = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_prn_delay_chips = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_tow_s = arma::zeros(n_true_epochs, 1);
|
||||
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++)
|
||||
{
|
||||
//******************************************************************************************
|
||||
//***** Obtain the initial signal sinchronization parameters (emulating an acquisition) ****
|
||||
//******************************************************************************************
|
||||
if (!FLAGS_enable_external_signal_file)
|
||||
{
|
||||
test_satellite_PRN = FLAGS_test_satellite_PRN;
|
||||
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");
|
||||
true_obs_data.close_obs_file();
|
||||
ASSERT_EQ(true_obs_data.open_obs_file(true_obs_file), true) << "Failure opening true observables file";
|
||||
// load acquisition data based on the first epoch of the true observations
|
||||
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?";
|
||||
std::cout << "Testing satellite PRN=" << test_satellite_PRN << std::endl;
|
||||
std::cout << "Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << std::endl;
|
||||
acq_doppler_hz = true_obs_data.doppler_l1_hz;
|
||||
acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) * static_cast<double>(baseband_sampling_freq) * GPS_L1_CA_CODE_PERIOD;
|
||||
// restart the epoch counter
|
||||
true_obs_data.restart();
|
||||
}
|
||||
|
||||
|
||||
//***** STEP 4: Configure the signal tracking parameters *****
|
||||
//************************************************************
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
|
||||
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_);
|
||||
|
||||
boost::shared_ptr<GpsL1CADllPllTrackingTest_msg_rx> msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make();
|
||||
|
||||
gnss_synchro.Acq_delay_samples = acq_delay_samples;
|
||||
gnss_synchro.Acq_doppler_hz = acq_doppler_hz;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block.";
|
||||
|
||||
ASSERT_NO_THROW({
|
||||
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);
|
||||
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);
|
||||
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of tracking test.";
|
||||
|
||||
|
||||
//********************************************************************
|
||||
//***** STEP 5: Perform the signal tracking and read the results *****
|
||||
//********************************************************************
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW({
|
||||
start = std::chrono::system_clock::now();
|
||||
top_block->run(); // Start threads and wait
|
||||
end = std::chrono::system_clock::now();
|
||||
}) << "Failure running the top_block.";
|
||||
|
||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||
std::cout << "Signal tracking completed in " << elapsed_seconds.count() << " seconds" << std::endl;
|
||||
|
||||
//check results
|
||||
//load the measured values
|
||||
tracking_dump_reader trk_dump;
|
||||
ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true)
|
||||
<< "Failure opening tracking dump file";
|
||||
|
||||
long int n_measured_epochs = trk_dump.num_epochs();
|
||||
std::cout << "Measured observation epochs=" << n_measured_epochs << std::endl;
|
||||
|
||||
arma::vec trk_timestamp_s = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_acc_carrier_phase_cycles = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_Doppler_Hz = arma::zeros(n_measured_epochs, 1);
|
||||
arma::vec trk_prn_delay_chips = arma::zeros(n_measured_epochs, 1);
|
||||
|
||||
long int epoch_counter = 0;
|
||||
while (true_obs_data.read_binary_obs())
|
||||
|
||||
std::vector<double> timestamp_s;
|
||||
std::vector<double> prompt;
|
||||
std::vector<double> early;
|
||||
std::vector<double> late;
|
||||
std::vector<double> promptI;
|
||||
std::vector<double> promptQ;
|
||||
std::vector<double> CN0_dBHz;
|
||||
while (trk_dump.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;
|
||||
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);
|
||||
|
||||
trk_prn_delay_chips(epoch_counter) = delay_chips;
|
||||
|
||||
timestamp_s.push_back(trk_timestamp_s(epoch_counter));
|
||||
prompt.push_back(trk_dump.abs_P);
|
||||
early.push_back(trk_dump.abs_E);
|
||||
late.push_back(trk_dump.abs_L);
|
||||
promptI.push_back(trk_dump.prompt_I);
|
||||
promptQ.push_back(trk_dump.prompt_Q);
|
||||
CN0_dBHz.push_back(trk_dump.CN0_SNV_dB_Hz);
|
||||
|
||||
epoch_counter++;
|
||||
}
|
||||
// Align initial measurements and cut the tracking pull-in transitory
|
||||
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");
|
||||
trk_timestamp_s_sweep.push_back(timestamp_s);
|
||||
prompt_sweep.push_back(prompt);
|
||||
early_sweep.push_back(early);
|
||||
late_sweep.push_back(late);
|
||||
promptI_sweep.push_back(promptI);
|
||||
promptQ_sweep.push_back(promptQ);
|
||||
CN0_dBHz_sweep.push_back(CN0_dBHz);
|
||||
|
||||
trk_timestamp_s = trk_timestamp_s.subvec(initial_meas_point(0), trk_timestamp_s.size() - 1);
|
||||
trk_acc_carrier_phase_cycles = trk_acc_carrier_phase_cycles.subvec(initial_meas_point(0), trk_acc_carrier_phase_cycles.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);
|
||||
//***********************************************************
|
||||
//***** STEP 6: Compare with true values (if available) *****
|
||||
//***********************************************************
|
||||
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
|
||||
long int n_true_epochs = true_obs_data.num_epochs();
|
||||
std::cout << "True observation epochs=" << n_true_epochs << std::endl;
|
||||
|
||||
std::vector<double> doppler_error_hz;
|
||||
std::vector<double> code_phase_error_chips;
|
||||
std::vector<double> acc_carrier_phase_hz;
|
||||
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);
|
||||
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);
|
||||
//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);
|
||||
trk_timestamp_s_sweep.push_back(vector_trk_timestamp_s);
|
||||
arma::vec true_timestamp_s = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_acc_carrier_phase_cycles = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_Doppler_Hz = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_prn_delay_chips = arma::zeros(n_true_epochs, 1);
|
||||
arma::vec true_tow_s = arma::zeros(n_true_epochs, 1);
|
||||
|
||||
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);
|
||||
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++;
|
||||
}
|
||||
// Align initial measurements and cut the tracking pull-in transitory
|
||||
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");
|
||||
|
||||
trk_timestamp_s = trk_timestamp_s.subvec(initial_meas_point(0), trk_timestamp_s.size() - 1);
|
||||
trk_acc_carrier_phase_cycles = trk_acc_carrier_phase_cycles.subvec(initial_meas_point(0), trk_acc_carrier_phase_cycles.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);
|
||||
|
||||
|
||||
double mean_error;
|
||||
double std_dev_error;
|
||||
|
||||
doppler_error_hz = check_results_doppler(true_timestamp_s, true_Doppler_Hz, trk_timestamp_s, trk_Doppler_Hz, mean_error, std_dev_error);
|
||||
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
|
||||
std::vector<double> vector_trk_timestamp_s(trk_timestamp_s.colptr(0), trk_timestamp_s.colptr(0) + trk_timestamp_s.n_rows);
|
||||
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);
|
||||
}
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
} //CN0 LOOP
|
||||
std::cout << "A\n\n\n";
|
||||
//********************************
|
||||
//***** STEP 7: Plot results *****
|
||||
//********************************
|
||||
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
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||
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++)
|
||||
{
|
||||
Gnuplot g1("linespoints");
|
||||
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_xlabel("Time [s]");
|
||||
g1.set_ylabel("Correlators' output");
|
||||
//g1.cmd("set key box opaque");
|
||||
g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), prompt_sweep.at(current_cn0_idx), "Prompt", decimate);
|
||||
g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), early_sweep.at(current_cn0_idx), "Early", decimate);
|
||||
g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), late_sweep.at(current_cn0_idx), "Late", decimate);
|
||||
g1.set_legend();
|
||||
g1.savetops("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)));
|
||||
g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18);
|
||||
}
|
||||
Gnuplot g2("points");
|
||||
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_xlabel("Inphase");
|
||||
g2.set_ylabel("Quadrature");
|
||||
//g2.cmd("set size ratio -1");
|
||||
g2.plot_xy(promptI_sweep.at(current_cn0_idx), promptQ_sweep.at(current_cn0_idx));
|
||||
}
|
||||
g2.unset_multiplot();
|
||||
g2.savetops("Constellation");
|
||||
g2.savetopdf("Constellation", 18);
|
||||
|
||||
Gnuplot g3("linespoints");
|
||||
g3.set_title("GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
g3.set_grid();
|
||||
g3.set_xlabel("Time [s]");
|
||||
g3.set_ylabel("Reported CN0 [dB-Hz]");
|
||||
g3.cmd("set key box opaque");
|
||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); 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);
|
||||
}
|
||||
g3.set_legend();
|
||||
g3.savetops("CN0_output");
|
||||
g3.savetopdf("CN0_output", 18);
|
||||
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");
|
||||
g4.showonscreen(); // window output
|
||||
g4.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++)
|
||||
{
|
||||
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);
|
||||
//g4.set_legend();
|
||||
}
|
||||
g4.unset_multiplot();
|
||||
g4.savetops("Doppler_error_output");
|
||||
g4.savetopdf("Doppler_error_output", 18);
|
||||
|
||||
Gnuplot g5("points");
|
||||
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_xlabel("Time [s]");
|
||||
g5.set_ylabel("Code delay error [Chips]");
|
||||
g5.cmd("set key box opaque");
|
||||
|
||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); 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);
|
||||
}
|
||||
g5.set_legend();
|
||||
g5.savetops("Code_error_output");
|
||||
g5.savetopdf("Code_error_output", 18);
|
||||
g5.showonscreen(); // window output
|
||||
|
||||
Gnuplot g6("points");
|
||||
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_xlabel("Time [s]");
|
||||
g6.set_ylabel("Accumulated carrier phase error [Cycles]");
|
||||
g6.cmd("set key box opaque");
|
||||
|
||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); 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);
|
||||
}
|
||||
g6.set_legend();
|
||||
g6.savetops("Carrier_phase_error_output");
|
||||
g6.savetopdf("Carrier_phase_error_output", 18);
|
||||
g6.showonscreen(); // window output
|
||||
}
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//********************************
|
||||
//***** STEP 7: Plot results *****
|
||||
//********************************
|
||||
if (FLAGS_plot_gps_l1_tracking_test == true)
|
||||
{
|
||||
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||
@ -643,110 +931,67 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::filesystem::path p(gnuplot_executable);
|
||||
boost::filesystem::path dir = p.parent_path();
|
||||
std::string gnuplot_path = dir.native();
|
||||
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||
std::vector<double> timevec;
|
||||
unsigned int decimate = static_cast<unsigned int>(FLAGS_plot_decimate);
|
||||
for (int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||
if (generator_CN0_values.size() > 1)
|
||||
{
|
||||
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++)
|
||||
//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++)
|
||||
{
|
||||
timevec.push_back(t);
|
||||
t = t + GPS_L1_CA_CODE_PERIOD;
|
||||
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");
|
||||
}
|
||||
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.set_grid();
|
||||
g1.set_xlabel("Time [s]");
|
||||
g1.set_ylabel("Correlators' output");
|
||||
g1.cmd("set key box opaque");
|
||||
g1.plot_xy(timevec, prompt_sweep.at(current_cn0_idx), "Prompt", decimate);
|
||||
g1.plot_xy(timevec, early_sweep.at(current_cn0_idx), "Early", decimate);
|
||||
g1.plot_xy(timevec, late_sweep.at(current_cn0_idx), "Late", decimate);
|
||||
g1.savetops("Correlators_outputs");
|
||||
g1.savetopdf("Correlators_outputs", 18);
|
||||
g1.showonscreen(); // window output
|
||||
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.set_grid();
|
||||
g2.set_xlabel("Inphase");
|
||||
g2.set_ylabel("Quadrature");
|
||||
g2.cmd("set size ratio -1");
|
||||
g2.plot_xy(promptI_sweep.at(current_cn0_idx), promptQ_sweep.at(current_cn0_idx));
|
||||
g2.savetops("Constellation");
|
||||
g2.savetopdf("Constellation", 18);
|
||||
g2.showonscreen(); // window output
|
||||
}
|
||||
Gnuplot g3("linespoints");
|
||||
g3.set_title("GPS L1 C/A tracking CN0 output (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
g3.set_grid();
|
||||
g3.set_xlabel("Time [s]");
|
||||
g3.set_ylabel("Reported CN0 [dB-Hz]");
|
||||
g3.cmd("set key box opaque");
|
||||
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),
|
||||
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
||||
}
|
||||
g3.set_legend();
|
||||
g3.savetops("CN0_output");
|
||||
g3.savetopdf("CN0_output", 18);
|
||||
g3.showonscreen(); // window output
|
||||
g7.savetops("Doppler_error_metrics");
|
||||
g7.savetopdf("Doppler_error_metrics", 18);
|
||||
|
||||
Gnuplot g4("points");
|
||||
g4.set_title("Doppler error (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
g4.set_grid();
|
||||
g4.set_xlabel("Time [s]");
|
||||
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++)
|
||||
{
|
||||
g4.plot_xy(trk_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);
|
||||
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);
|
||||
}
|
||||
g4.set_legend();
|
||||
g4.savetops("Doppler_error_output");
|
||||
g4.savetopdf("Doppler_error_output", 18);
|
||||
g4.showonscreen(); // window output
|
||||
|
||||
Gnuplot g5("points");
|
||||
g5.set_title("Code delay error (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
g5.set_grid();
|
||||
g5.set_xlabel("Time [s]");
|
||||
g5.set_ylabel("Code delay error [Chips]");
|
||||
g5.cmd("set key box opaque");
|
||||
|
||||
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),
|
||||
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
||||
}
|
||||
g5.set_legend();
|
||||
g5.savetops("Code_error_output");
|
||||
g5.savetopdf("Code_error_output", 18);
|
||||
g5.showonscreen(); // window output
|
||||
|
||||
Gnuplot g6("points");
|
||||
g6.set_title("Accumulated carrier phase error (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||
g6.set_grid();
|
||||
g6.set_xlabel("Time [s]");
|
||||
g6.set_ylabel("Accumulated carrier phase error [Cycles]");
|
||||
g6.cmd("set key box opaque");
|
||||
|
||||
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),
|
||||
std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate);
|
||||
}
|
||||
g6.set_legend();
|
||||
g6.savetops("Carrier_phase_error_output");
|
||||
g6.savetopdf("Carrier_phase_error_output", 18);
|
||||
g6.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
|
@ -33,6 +33,8 @@ file = 'acq';
|
||||
|
||||
sat = 7;
|
||||
|
||||
channel = 0;
|
||||
execution = 1;
|
||||
% Signal:
|
||||
% 1 GPS L1
|
||||
% 2 GPS L2M
|
||||
@ -77,7 +79,7 @@ switch(signal_type)
|
||||
system = 'R';
|
||||
signal = '1G';
|
||||
end
|
||||
filename = [path file '_' system '_' signal '_sat_' num2str(sat) '.mat'];
|
||||
filename = [path file '_' system '_' signal '_ch_' num2str(channel) '_' num2str(execution) '_sat_' num2str(sat) '.mat'];
|
||||
load(filename);
|
||||
[n_fft n_dop_bins] = size(grid);
|
||||
[d_max f_max] = find(grid == max(max(grid)));
|
||||
|
Loading…
Reference in New Issue
Block a user