mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 20:50:33 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into release_0010
This commit is contained in:
commit
34ddcc35d0
@ -18,7 +18,4 @@
|
||||
|
||||
add_subdirectory(adapters)
|
||||
add_subdirectory(gnuradio_blocks)
|
||||
if(ENABLE_FPGA)
|
||||
add_subdirectory(libs)
|
||||
endif(ENABLE_FPGA)
|
||||
|
||||
add_subdirectory(libs)
|
||||
|
@ -65,4 +65,4 @@ file(GLOB ACQ_ADAPTER_HEADERS "*.h")
|
||||
list(SORT ACQ_ADAPTER_HEADERS)
|
||||
add_library(acq_adapters ${ACQ_ADAPTER_SOURCES} ${ACQ_ADAPTER_HEADERS})
|
||||
source_group(Headers FILES ${ACQ_ADAPTER_HEADERS})
|
||||
target_link_libraries(acq_adapters gnss_sp_libs gnss_sdr_flags acq_gr_blocks ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES})
|
||||
target_link_libraries(acq_adapters acquisition_lib gnss_sp_libs gnss_sdr_flags acq_gr_blocks ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES})
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "galileo_e1_signal_processing.h"
|
||||
#include "Galileo_E1.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "acq_conf.h"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
@ -45,7 +46,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
pcpsconf_t acq_parameters;
|
||||
Acq_Conf acq_parameters;
|
||||
configuration_ = configuration;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./data/acquisition.dat";
|
||||
@ -59,6 +60,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
@ -102,6 +104,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "galileo_e5_signal_processing.h"
|
||||
#include "Galileo_E5a.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "acq_conf.h"
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
@ -44,7 +45,7 @@ using google::LogMessage;
|
||||
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
pcpsconf_t acq_parameters;
|
||||
Acq_Conf acq_parameters = Acq_Conf();
|
||||
configuration_ = configuration;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "../data/acquisition.dat";
|
||||
@ -64,6 +65,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
||||
}
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||
acq_parameters.doppler_max = doppler_max_;
|
||||
@ -104,6 +106,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
||||
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||
|
||||
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "configuration_interface.h"
|
||||
#include "glonass_l1_signal_processing.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "acq_conf.h"
|
||||
#include "GLONASS_L1_L2_CA.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
@ -46,7 +47,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
pcpsconf_t acq_parameters;
|
||||
Acq_Conf acq_parameters = Acq_Conf();
|
||||
configuration_ = configuration;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./data/acquisition.dat";
|
||||
@ -60,6 +61,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
@ -102,6 +104,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "glonass_l2_signal_processing.h"
|
||||
#include "GLONASS_L1_L2_CA.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "acq_conf.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
|
||||
@ -45,7 +46,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
pcpsconf_t acq_parameters;
|
||||
Acq_Conf acq_parameters = Acq_Conf();
|
||||
configuration_ = configuration;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./data/acquisition.dat";
|
||||
@ -59,6 +60,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
@ -101,6 +103,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "acq_conf.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
|
||||
@ -48,7 +49,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
pcpsconf_t acq_parameters;
|
||||
Acq_Conf acq_parameters = Acq_Conf();
|
||||
configuration_ = configuration;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./data/acquisition.dat";
|
||||
@ -61,6 +62,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
@ -102,6 +104,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
acq_parameters.samples_per_ms = code_length_;
|
||||
acq_parameters.samples_per_code = code_length_;
|
||||
acq_parameters.it_size = item_size_;
|
||||
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "gps_l2c_signal.h"
|
||||
#include "GPS_L2C.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "acq_conf.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
|
||||
@ -46,7 +47,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
pcpsconf_t acq_parameters;
|
||||
Acq_Conf acq_parameters = Acq_Conf();
|
||||
configuration_ = configuration;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./data/acquisition.dat";
|
||||
@ -61,6 +62,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
||||
@ -101,6 +103,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", true);
|
||||
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "gps_l5_signal.h"
|
||||
#include "GPS_L5.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "acq_conf.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
|
||||
@ -46,7 +47,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
pcpsconf_t acq_parameters;
|
||||
Acq_Conf acq_parameters = Acq_Conf();
|
||||
configuration_ = configuration;
|
||||
std::string default_item_type = "gr_complex";
|
||||
std::string default_dump_filename = "./data/acquisition.dat";
|
||||
@ -60,6 +61,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
acq_parameters.fs_in = fs_in_;
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
acq_parameters.dump = dump_;
|
||||
acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0);
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
||||
@ -100,6 +102,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false);
|
||||
acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false);
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
|
@ -26,12 +26,12 @@ set(ACQ_GR_BLOCKS_SOURCES
|
||||
pcps_quicksync_acquisition_cc.cc
|
||||
galileo_pcps_8ms_acquisition_cc.cc
|
||||
galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc
|
||||
)
|
||||
)
|
||||
|
||||
if(ENABLE_FPGA)
|
||||
set(ACQ_GR_BLOCKS_SOURCES ${ACQ_GR_BLOCKS_SOURCES} pcps_acquisition_fpga.cc)
|
||||
endif(ENABLE_FPGA)
|
||||
|
||||
|
||||
if(OPENCL_FOUND)
|
||||
set(ACQ_GR_BLOCKS_SOURCES ${ACQ_GR_BLOCKS_SOURCES} pcps_opencl_acquisition_cc.cc)
|
||||
endif(OPENCL_FOUND)
|
||||
@ -64,7 +64,7 @@ endif(OPENCL_FOUND)
|
||||
file(GLOB ACQ_GR_BLOCKS_HEADERS "*.h")
|
||||
list(SORT ACQ_GR_BLOCKS_HEADERS)
|
||||
add_library(acq_gr_blocks ${ACQ_GR_BLOCKS_SOURCES} ${ACQ_GR_BLOCKS_HEADERS})
|
||||
source_group(Headers FILES ${ACQ_GR_BLOCKS_HEADERS})
|
||||
source_group(Headers FILES ${ACQ_GR_BLOCKS_HEADERS})
|
||||
|
||||
if(ENABLE_FPGA)
|
||||
target_link_libraries(acq_gr_blocks acquisition_lib gnss_sp_libs gnss_system_parameters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${VOLK_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${OPT_LIBRARIES} ${OPT_ACQUISITION_LIBRARIES})
|
||||
|
@ -45,21 +45,22 @@
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
pcps_acquisition_sptr pcps_make_acquisition(pcpsconf_t conf_)
|
||||
pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_)
|
||||
{
|
||||
return pcps_acquisition_sptr(new pcps_acquisition(conf_));
|
||||
}
|
||||
|
||||
|
||||
pcps_acquisition::pcps_acquisition(pcpsconf_t conf_) : gr::block("pcps_acquisition",
|
||||
gr::io_signature::make(1, 1, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1)),
|
||||
gr::io_signature::make(0, 0, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1)))
|
||||
pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acquisition",
|
||||
gr::io_signature::make(1, 1, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1)),
|
||||
gr::io_signature::make(0, 0, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1)))
|
||||
{
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
|
||||
acq_parameters = conf_;
|
||||
d_sample_counter = 0; // SAMPLE COUNTER
|
||||
d_active = false;
|
||||
d_positive_acq = 0;
|
||||
d_state = 0;
|
||||
d_old_freq = 0;
|
||||
d_well_count = 0;
|
||||
@ -121,6 +122,8 @@ pcps_acquisition::pcps_acquisition(pcpsconf_t conf_) : gr::block("pcps_acquisiti
|
||||
}
|
||||
grid_ = arma::fmat();
|
||||
d_step_two = false;
|
||||
d_dump_number = 0;
|
||||
d_dump_channel = acq_parameters.dump_channel;
|
||||
}
|
||||
|
||||
|
||||
@ -312,7 +315,7 @@ void pcps_acquisition::send_positive_acquisition()
|
||||
<< ", doppler " << d_gnss_synchro->Acq_doppler_hz
|
||||
<< ", magnitude " << d_mag
|
||||
<< ", input signal power " << d_input_power;
|
||||
|
||||
d_positive_acq = 1;
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(1));
|
||||
}
|
||||
|
||||
@ -330,11 +333,90 @@ void pcps_acquisition::send_negative_acquisition()
|
||||
<< ", doppler " << d_gnss_synchro->Acq_doppler_hz
|
||||
<< ", magnitude " << d_mag
|
||||
<< ", input signal power " << d_input_power;
|
||||
|
||||
d_positive_acq = 0;
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(2));
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition::dump_results(int effective_fft_size)
|
||||
{
|
||||
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::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("acq_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);
|
||||
|
||||
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("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_positive_acq, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
float aux = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
|
||||
matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
aux = static_cast<float>(d_gnss_synchro->Acq_delay_samples);
|
||||
matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_test_statistics, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_threshold, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_input_power, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims, &d_sample_counter, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_gnss_synchro->PRN, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
Mat_Close(matfp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
{
|
||||
gr::thread::scoped_lock lk(d_setlock);
|
||||
@ -342,7 +424,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)
|
||||
{
|
||||
@ -433,46 +515,9 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
}
|
||||
}
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump)
|
||||
if (acq_parameters.dump and d_channel == d_dump_channel)
|
||||
{
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
||||
if (doppler_index == (d_num_doppler_bins - 1))
|
||||
{
|
||||
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");
|
||||
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_SINGLE, 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_SINGLE, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -538,6 +583,11 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
d_test_statistics = d_mag / d_input_power;
|
||||
}
|
||||
}
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump and d_channel == d_dump_channel)
|
||||
{
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
lk.lock();
|
||||
@ -607,6 +657,11 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
|
||||
}
|
||||
}
|
||||
d_worker_active = false;
|
||||
// Record results to file if required
|
||||
if (acq_parameters.dump and d_channel == d_dump_channel)
|
||||
{
|
||||
pcps_acquisition::dump_results(effective_fft_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -628,8 +683,11 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
|
||||
gr::thread::scoped_lock lk(d_setlock);
|
||||
if (!d_active or d_worker_active)
|
||||
{
|
||||
d_sample_counter += d_fft_size * ninput_items[0];
|
||||
consume_each(ninput_items[0]);
|
||||
if (!acq_parameters.blocking_on_standby)
|
||||
{
|
||||
d_sample_counter += d_fft_size * ninput_items[0];
|
||||
consume_each(ninput_items[0]);
|
||||
}
|
||||
if (d_step_two)
|
||||
{
|
||||
d_doppler_center_step_two = static_cast<float>(d_gnss_synchro->Acq_doppler_hz);
|
||||
@ -653,8 +711,11 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
|
||||
d_input_power = 0.0;
|
||||
d_test_statistics = 0.0;
|
||||
d_state = 1;
|
||||
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter
|
||||
consume_each(ninput_items[0]);
|
||||
if (!acq_parameters.blocking_on_standby)
|
||||
{
|
||||
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter
|
||||
consume_each(ninput_items[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -53,38 +53,20 @@
|
||||
#define GNSS_SDR_PCPS_ACQUISITION_H_
|
||||
|
||||
#include "gnss_synchro.h"
|
||||
#include "acq_conf.h"
|
||||
#include <armadillo>
|
||||
#include <gnuradio/block.h>
|
||||
#include <gnuradio/fft/fft.h>
|
||||
#include <volk/volk.h>
|
||||
#include <string>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* pcps acquisition configuration */
|
||||
unsigned int sampled_ms;
|
||||
unsigned int max_dwells;
|
||||
unsigned int doppler_max;
|
||||
unsigned int num_doppler_bins_step2;
|
||||
float doppler_step2;
|
||||
long fs_in;
|
||||
int samples_per_ms;
|
||||
int samples_per_code;
|
||||
bool bit_transition_flag;
|
||||
bool use_CFAR_algorithm_flag;
|
||||
bool dump;
|
||||
bool blocking;
|
||||
bool make_2_steps;
|
||||
std::string dump_filename;
|
||||
size_t it_size;
|
||||
} pcpsconf_t;
|
||||
|
||||
class pcps_acquisition;
|
||||
|
||||
typedef boost::shared_ptr<pcps_acquisition> pcps_acquisition_sptr;
|
||||
|
||||
pcps_acquisition_sptr
|
||||
pcps_make_acquisition(pcpsconf_t conf_);
|
||||
pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a Parallel Code Phase Search Acquisition.
|
||||
@ -96,9 +78,9 @@ class pcps_acquisition : public gr::block
|
||||
{
|
||||
private:
|
||||
friend pcps_acquisition_sptr
|
||||
pcps_make_acquisition(pcpsconf_t conf_);
|
||||
pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
|
||||
pcps_acquisition(pcpsconf_t conf_);
|
||||
pcps_acquisition(const Acq_Conf& conf_);
|
||||
|
||||
void update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq);
|
||||
void update_grid_doppler_wipeoffs();
|
||||
@ -111,11 +93,14 @@ private:
|
||||
|
||||
void send_positive_acquisition();
|
||||
|
||||
pcpsconf_t acq_parameters;
|
||||
void dump_results(int effective_fft_size);
|
||||
|
||||
Acq_Conf acq_parameters;
|
||||
bool d_active;
|
||||
bool d_worker_active;
|
||||
bool d_cshort;
|
||||
bool d_step_two;
|
||||
int d_positive_acq;
|
||||
float d_threshold;
|
||||
float d_mag;
|
||||
float d_input_power;
|
||||
@ -139,6 +124,8 @@ private:
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
arma::fmat grid_;
|
||||
long int d_dump_number;
|
||||
unsigned int d_dump_channel;
|
||||
|
||||
public:
|
||||
~pcps_acquisition();
|
||||
|
@ -16,12 +16,9 @@
|
||||
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
|
||||
set(ACQUISITION_LIB_SOURCES
|
||||
fpga_acquisition.cc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
if(ENABLE_FPGA)
|
||||
set(ACQUISITION_LIB_SOURCES fpga_acquisition.cc )
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_SOURCE_DIR}/src/core/system_parameters
|
||||
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
||||
@ -31,10 +28,16 @@ include_directories(
|
||||
${GLOG_INCLUDE_DIRS}
|
||||
${GFlags_INCLUDE_DIRS}
|
||||
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
||||
)
|
||||
)
|
||||
|
||||
file(GLOB ACQUISITION_LIB_HEADERS "*.h")
|
||||
file(GLOB ACQUISITION_LIB_HEADERS "*.h")
|
||||
endif(ENABLE_FPGA)
|
||||
|
||||
set(ACQUISITION_LIB_HEADERS ${ACQUISITION_LIB_HEADERS} acq_conf.h)
|
||||
list(SORT ACQUISITION_LIB_HEADERS)
|
||||
|
||||
set(ACQUISITION_LIB_SOURCES ${ACQUISITION_LIB_SOURCES} acq_conf.cc)
|
||||
|
||||
add_library(acquisition_lib ${ACQUISITION_LIB_SOURCES} ${ACQUISITION_LIB_HEADERS})
|
||||
source_group(Headers FILES ${ACQUISITION_LIB_HEADERS})
|
||||
target_link_libraries(acquisition_lib ${VOLK_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES})
|
||||
@ -43,4 +46,3 @@ if(VOLK_GNSSSDR_FOUND)
|
||||
else(VOLK_GNSSSDR_FOUND)
|
||||
add_dependencies(acquisition_lib glog-${glog_RELEASE} volk_gnsssdr_module)
|
||||
endif()
|
||||
|
||||
|
54
src/algorithms/acquisition/libs/acq_conf.cc
Normal file
54
src/algorithms/acquisition/libs/acq_conf.cc
Normal file
@ -0,0 +1,54 @@
|
||||
/*!
|
||||
* \file acq_conf.cc
|
||||
* \brief Class that contains all the configuration parameters for generic
|
||||
* acquisition block based on the PCPS algoritm.
|
||||
* \author Carles Fernandez, 2018. cfernandez(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "acq_conf.h"
|
||||
|
||||
Acq_Conf::Acq_Conf()
|
||||
{
|
||||
/* PCPS acquisition configuration */
|
||||
sampled_ms = 0;
|
||||
max_dwells = 0;
|
||||
doppler_max = 0;
|
||||
num_doppler_bins_step2 = 0;
|
||||
doppler_step2 = 0.0;
|
||||
fs_in = 0;
|
||||
samples_per_ms = 0;
|
||||
samples_per_code = 0;
|
||||
bit_transition_flag = false;
|
||||
use_CFAR_algorithm_flag = false;
|
||||
dump = false;
|
||||
blocking = false;
|
||||
make_2_steps = false;
|
||||
dump_filename = "";
|
||||
dump_channel = 0;
|
||||
it_size = sizeof(char);
|
||||
blocking_on_standby = false;
|
||||
}
|
63
src/algorithms/acquisition/libs/acq_conf.h
Normal file
63
src/algorithms/acquisition/libs/acq_conf.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*!
|
||||
* \file acq_conf.cc
|
||||
* \brief Class that contains all the configuration parameters for generic
|
||||
* acquisition block based on the PCPS algoritm.
|
||||
* \author Carles Fernandez, 2018. cfernandez(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_ACQ_CONF_H_
|
||||
#define GNSS_SDR_ACQ_CONF_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
class Acq_Conf
|
||||
{
|
||||
public:
|
||||
/* PCPS Acquisition configuration */
|
||||
unsigned int sampled_ms;
|
||||
unsigned int max_dwells;
|
||||
unsigned int doppler_max;
|
||||
unsigned int num_doppler_bins_step2;
|
||||
float doppler_step2;
|
||||
long fs_in;
|
||||
int samples_per_ms;
|
||||
int samples_per_code;
|
||||
bool bit_transition_flag;
|
||||
bool use_CFAR_algorithm_flag;
|
||||
bool dump;
|
||||
bool blocking;
|
||||
bool blocking_on_standby; // enable it only for unit testing to avoid sample consume on idle status
|
||||
bool make_2_steps;
|
||||
std::string dump_filename;
|
||||
unsigned int dump_channel;
|
||||
size_t it_size;
|
||||
|
||||
Acq_Conf();
|
||||
};
|
||||
|
||||
#endif
|
@ -34,6 +34,7 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "dll_pll_conf.h"
|
||||
#include "galileo_e1_dll_pll_veml_tracking.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "Galileo_E1.h"
|
||||
@ -48,7 +49,7 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
dllpllconf_t trk_param;
|
||||
Dll_Pll_Conf trk_param = Dll_Pll_Conf();
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
std::string default_item_type = "gr_complex";
|
||||
|
@ -35,7 +35,7 @@
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "dll_pll_conf.h"
|
||||
#include "galileo_e5a_dll_pll_tracking.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "Galileo_E5a.h"
|
||||
@ -49,7 +49,7 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
dllpllconf_t trk_param;
|
||||
Dll_Pll_Conf trk_param = Dll_Pll_Conf();
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
std::string default_item_type = "gr_complex";
|
||||
|
@ -35,7 +35,7 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "dll_pll_conf.h"
|
||||
#include "gps_l1_ca_dll_pll_tracking.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
@ -49,7 +49,7 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
dllpllconf_t trk_param;
|
||||
Dll_Pll_Conf trk_param = Dll_Pll_Conf();
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
std::string default_item_type = "gr_complex";
|
||||
@ -108,13 +108,13 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
|
||||
int cn0_samples = configuration->property(role + ".cn0_samples", 20);
|
||||
if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples;
|
||||
trk_param.cn0_samples = cn0_samples;
|
||||
int cn0_min = configuration->property(role + ".cn0_min", 25);
|
||||
int cn0_min = configuration->property(role + ".cn0_min", 30);
|
||||
if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min;
|
||||
trk_param.cn0_min = cn0_min;
|
||||
int max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
|
||||
if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail;
|
||||
trk_param.max_lock_fail = max_lock_fail;
|
||||
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85);
|
||||
double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.80);
|
||||
if (FLAGS_carrier_lock_th != 0.85) carrier_lock_th = FLAGS_carrier_lock_th;
|
||||
trk_param.carrier_lock_th = carrier_lock_th;
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "dll_pll_conf.h"
|
||||
#include "gps_l2_m_dll_pll_tracking.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "GPS_L2C.h"
|
||||
@ -49,7 +49,7 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
dllpllconf_t trk_param;
|
||||
Dll_Pll_Conf trk_param = Dll_Pll_Conf();
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
std::string default_item_type = "gr_complex";
|
||||
|
@ -34,7 +34,7 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "dll_pll_conf.h"
|
||||
#include "gps_l5_dll_pll_tracking.h"
|
||||
#include "configuration_interface.h"
|
||||
#include "GPS_L5.h"
|
||||
@ -49,7 +49,7 @@ GpsL5DllPllTracking::GpsL5DllPllTracking(
|
||||
ConfigurationInterface* configuration, std::string role,
|
||||
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
dllpllconf_t trk_param;
|
||||
Dll_Pll_Conf trk_param = Dll_Pll_Conf();
|
||||
DLOG(INFO) << "role " << role;
|
||||
//################# CONFIGURATION PARAMETERS ########################
|
||||
std::string default_item_type = "gr_complex";
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(dllpllconf_t conf_)
|
||||
dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_)
|
||||
{
|
||||
return dll_pll_veml_tracking_sptr(new dll_pll_veml_tracking(conf_));
|
||||
}
|
||||
@ -76,8 +76,8 @@ void dll_pll_veml_tracking::forecast(int noutput_items,
|
||||
}
|
||||
|
||||
|
||||
dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dll_pll_veml_tracking", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::block("dll_pll_veml_tracking", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
trk_parameters = conf_;
|
||||
// Telemetry bit synchronization message port input
|
||||
|
@ -31,6 +31,7 @@
|
||||
#ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_H
|
||||
#define GNSS_SDR_DLL_PLL_VEML_TRACKING_H
|
||||
|
||||
#include "dll_pll_conf.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "tracking_2nd_DLL_filter.h"
|
||||
#include "tracking_2nd_PLL_filter.h"
|
||||
@ -39,37 +40,13 @@
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* DLL/PLL tracking configuration */
|
||||
double fs_in;
|
||||
unsigned int vector_length;
|
||||
bool dump;
|
||||
std::string dump_filename;
|
||||
float pll_bw_hz;
|
||||
float dll_bw_hz;
|
||||
float pll_bw_narrow_hz;
|
||||
float dll_bw_narrow_hz;
|
||||
float early_late_space_chips;
|
||||
float very_early_late_space_chips;
|
||||
float early_late_space_narrow_chips;
|
||||
float very_early_late_space_narrow_chips;
|
||||
int extend_correlation_symbols;
|
||||
int cn0_samples;
|
||||
int cn0_min;
|
||||
int max_lock_fail;
|
||||
double carrier_lock_th;
|
||||
bool track_pilot;
|
||||
char system;
|
||||
char signal[3];
|
||||
} dllpllconf_t;
|
||||
#include <queue>
|
||||
|
||||
class dll_pll_veml_tracking;
|
||||
|
||||
typedef boost::shared_ptr<dll_pll_veml_tracking> dll_pll_veml_tracking_sptr;
|
||||
|
||||
dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(dllpllconf_t conf_);
|
||||
dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a code DLL + carrier PLL tracking block.
|
||||
@ -89,9 +66,9 @@ public:
|
||||
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||
|
||||
private:
|
||||
friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(dllpllconf_t conf_);
|
||||
friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_);
|
||||
|
||||
dll_pll_veml_tracking(dllpllconf_t conf_);
|
||||
dll_pll_veml_tracking(const Dll_Pll_Conf &conf_);
|
||||
|
||||
bool cn0_and_tracking_lock_status(double coh_integration_time_s);
|
||||
bool acquire_secondary();
|
||||
@ -104,7 +81,7 @@ private:
|
||||
int save_matfile();
|
||||
|
||||
// tracking configuration vars
|
||||
dllpllconf_t trk_parameters;
|
||||
Dll_Pll_Conf trk_parameters;
|
||||
bool d_veml;
|
||||
bool d_cloop;
|
||||
unsigned int d_channel;
|
||||
@ -201,6 +178,7 @@ private:
|
||||
// CN0 estimation and lock detector
|
||||
int d_cn0_estimation_counter;
|
||||
int d_carrier_lock_fail_counter;
|
||||
std::deque<float> d_carrier_lock_detector_queue;
|
||||
double d_carrier_lock_test;
|
||||
double d_CN0_SNV_dB_Hz;
|
||||
double d_carrier_lock_threshold;
|
||||
|
@ -43,6 +43,7 @@ set(TRACKING_LIB_SOURCES
|
||||
tracking_discriminators.cc
|
||||
tracking_FLL_PLL_filter.cc
|
||||
tracking_loop_filter.cc
|
||||
dll_pll_conf.cc
|
||||
)
|
||||
|
||||
if(ENABLE_FPGA)
|
||||
|
61
src/algorithms/tracking/libs/dll_pll_conf.cc
Normal file
61
src/algorithms/tracking/libs/dll_pll_conf.cc
Normal file
@ -0,0 +1,61 @@
|
||||
/*!
|
||||
* \file dll_pll_conf.cc
|
||||
* \brief Class that contains all the configuration parameters for generic
|
||||
* tracking block based on a DLL and a PLL.
|
||||
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "dll_pll_conf.h"
|
||||
#include <cstring>
|
||||
|
||||
Dll_Pll_Conf::Dll_Pll_Conf()
|
||||
{
|
||||
/* DLL/PLL tracking configuration */
|
||||
fs_in = 0.0;
|
||||
vector_length = 0;
|
||||
dump = false;
|
||||
dump_filename = "./dll_pll_dump.dat";
|
||||
pll_bw_hz = 40.0;
|
||||
dll_bw_hz = 2.0;
|
||||
pll_bw_narrow_hz = 5.0;
|
||||
dll_bw_narrow_hz = 0.75;
|
||||
early_late_space_chips = 0.5;
|
||||
very_early_late_space_chips = 0.5;
|
||||
early_late_space_narrow_chips = 0.1;
|
||||
very_early_late_space_narrow_chips = 0.1;
|
||||
extend_correlation_symbols = 5;
|
||||
cn0_samples = 20;
|
||||
carrier_lock_det_mav_samples = 20;
|
||||
cn0_min = 25;
|
||||
max_lock_fail = 50;
|
||||
carrier_lock_th = 0.85;
|
||||
track_pilot = false;
|
||||
system = 'G';
|
||||
char sig_[3] = "1C";
|
||||
std::memcpy(signal, sig_, 3);
|
||||
}
|
68
src/algorithms/tracking/libs/dll_pll_conf.h
Normal file
68
src/algorithms/tracking/libs/dll_pll_conf.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*!
|
||||
* \file dll_pll_conf.h
|
||||
* \brief Class that contains all the configuration parameters for generic tracking block based on a DLL and a PLL.
|
||||
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that contains all the configuration parameters for generic tracking block based on a DLL and a PLL.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_DLL_PLL_CONF_H_
|
||||
#define GNSS_SDR_DLL_PLL_CONF_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
class Dll_Pll_Conf
|
||||
{
|
||||
private:
|
||||
public:
|
||||
/* DLL/PLL tracking configuration */
|
||||
double fs_in;
|
||||
unsigned int vector_length;
|
||||
bool dump;
|
||||
std::string dump_filename;
|
||||
float pll_bw_hz;
|
||||
float dll_bw_hz;
|
||||
float pll_bw_narrow_hz;
|
||||
float dll_bw_narrow_hz;
|
||||
float early_late_space_chips;
|
||||
float very_early_late_space_chips;
|
||||
float early_late_space_narrow_chips;
|
||||
float very_early_late_space_narrow_chips;
|
||||
int extend_correlation_symbols;
|
||||
int cn0_samples;
|
||||
int carrier_lock_det_mav_samples;
|
||||
int cn0_min;
|
||||
int max_lock_fail;
|
||||
double carrier_lock_th;
|
||||
bool track_pilot;
|
||||
char system;
|
||||
char signal[3];
|
||||
|
||||
Dll_Pll_Conf();
|
||||
};
|
||||
|
||||
#endif
|
@ -117,6 +117,13 @@ void InMemoryConfiguration::set_property(std::string property_name, std::string
|
||||
}
|
||||
|
||||
|
||||
void InMemoryConfiguration::supersede_property(std::string property_name, std::string value)
|
||||
{
|
||||
properties_.erase(property_name);
|
||||
properties_.insert(std::make_pair(property_name, value));
|
||||
}
|
||||
|
||||
|
||||
bool InMemoryConfiguration::is_present(std::string property_name)
|
||||
{
|
||||
return (properties_.find(property_name) != properties_.end());
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
float property(std::string property_name, float default_value);
|
||||
double property(std::string property_name, double default_value);
|
||||
void set_property(std::string property_name, std::string value);
|
||||
void supersede_property(std::string property_name, std::string value);
|
||||
bool is_present(std::string property_name);
|
||||
|
||||
private:
|
||||
|
@ -47,7 +47,7 @@
|
||||
#ifndef GNSS_SDR_GNUPLOT_I_H_
|
||||
#define GNSS_SDR_GNUPLOT_I_H_
|
||||
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -61,6 +61,7 @@
|
||||
#include <list> // for std::list
|
||||
#include <sys/stat.h>
|
||||
|
||||
DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive testing.");
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
|
||||
//defined for 32 and 64-bit environments
|
||||
@ -69,7 +70,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 +303,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 +1907,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 +1975,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 +2019,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__)
|
||||
|
@ -32,6 +32,7 @@
|
||||
#define GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H_
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
#include <limits>
|
||||
|
||||
DEFINE_bool(disable_generator, false, "Disable the signal generator (a external signal file must be available for the test)");
|
||||
DEFINE_string(generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary");
|
||||
@ -44,5 +45,6 @@ DEFINE_string(filename_raw_data, "signal_out.bin", "Filename of output raw data
|
||||
DEFINE_int32(fs_gen_sps, 2600000, "Sampling frequency [sps]");
|
||||
DEFINE_int32(test_satellite_PRN, 1, "PRN of the satellite under test (must be visible during the observation time)");
|
||||
DEFINE_int32(test_satellite_PRN2, 2, "PRN of the satellite under test (must be visible during the observation time)");
|
||||
DEFINE_double(CN0_dBHz, std::numeric_limits<double>::infinity(), "Enable noise generator and set the CN0 [dB-Hz]");
|
||||
|
||||
#endif
|
||||
|
75
src/tests/common-files/tracking_tests_flags.h
Normal file
75
src/tests/common-files/tracking_tests_flags.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*!
|
||||
* \file tracking_tests_flags.h
|
||||
* \brief Helper file for unit testing
|
||||
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_TRACKING_TESTS_FLAGS_H_
|
||||
#define GNSS_SDR_TRACKING_TESTS_FLAGS_H_
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
#include <limits>
|
||||
|
||||
// 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_double(PLL_narrow_bw_hz, 5.0, "PLL Narrow configuration value [Hz]");
|
||||
DEFINE_double(DLL_narrow_bw_hz, 0.75, "DLL Narrow configuration value [Hz]");
|
||||
|
||||
DEFINE_double(Acq_Doppler_error_hz_start, 500.0, "Acquisition Doppler error start sweep value [Hz]");
|
||||
DEFINE_double(Acq_Doppler_error_hz_stop, -500.0, "Acquisition Doppler error stop sweep value [Hz]");
|
||||
DEFINE_double(Acq_Doppler_error_hz_step, -50.0, "Acquisition Doppler error sweep step value [Hz]");
|
||||
|
||||
DEFINE_double(Acq_Delay_error_chips_start, 2.0, "Acquisition Code Delay error start sweep value [Hz]");
|
||||
DEFINE_double(Acq_Delay_error_chips_stop, -2.0, "Acquisition Code Delay error stop sweep value [Hz]");
|
||||
DEFINE_double(Acq_Delay_error_chips_step, -0.1, "Acquisition Code Delay error sweep step value [Hz]");
|
||||
|
||||
|
||||
DEFINE_int32(plot_detail_level, 0, "Specify the desired plot detail (0,1,2): 0 - Minimum plots (default) 2 - Plot all tracking parameters");
|
||||
|
||||
//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)");
|
||||
|
||||
//Test output configuration
|
||||
DEFINE_bool(plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot");
|
||||
|
||||
|
||||
#endif
|
@ -620,7 +620,7 @@ void ObsSystemTest::compute_pseudorange_error(
|
||||
}
|
||||
g1.savetops("Pseudorange_error_" + signal_name);
|
||||
g1.savetopdf("Pseudorange_error_" + signal_name, 18);
|
||||
g1.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
@ -711,7 +711,7 @@ void ObsSystemTest::compute_carrierphase_error(
|
||||
}
|
||||
g1.savetops("Carrier_phase_error_" + signal_name);
|
||||
g1.savetopdf("Carrier_phase_error_" + signal_name, 18);
|
||||
g1.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
@ -802,7 +802,7 @@ void ObsSystemTest::compute_doppler_error(
|
||||
}
|
||||
g1.savetops("Doppler_error_" + signal_name);
|
||||
g1.savetopdf("Doppler_error_" + signal_name, 18);
|
||||
g1.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g1.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ int StaticPositionSystemTest::configure_receiver()
|
||||
config->set_property("Channel.signal", "1C");
|
||||
|
||||
// Set Acquisition
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms));
|
||||
config->set_property("Acquisition_1C.threshold", std::to_string(threshold));
|
||||
@ -347,6 +347,9 @@ int StaticPositionSystemTest::configure_receiver()
|
||||
config->set_property("Acquisition_1C.tong_init_val", std::to_string(tong_init_val));
|
||||
config->set_property("Acquisition_1C.tong_max_val", std::to_string(tong_max_val));
|
||||
config->set_property("Acquisition_1C.tong_max_dwells", std::to_string(tong_max_dwells));
|
||||
config->set_property("Acquisition_1C.dump", "false");
|
||||
config->set_property("Acquisition_1C.dump_filename", "./acquisition");
|
||||
config->set_property("Acquisition_1C.dump_channel", "1");
|
||||
|
||||
// Set Tracking
|
||||
config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
|
||||
@ -632,7 +635,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double>& east,
|
||||
|
||||
g1.savetops("Position_test_2D");
|
||||
g1.savetopdf("Position_test_2D", 18);
|
||||
g1.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("points");
|
||||
g2.set_title("3D precision");
|
||||
@ -653,7 +656,7 @@ void StaticPositionSystemTest::print_results(const std::vector<double>& east,
|
||||
|
||||
g2.savetops("Position_test_3D");
|
||||
g2.savetopdf("Position_test_3D");
|
||||
g2.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
|
@ -145,8 +145,10 @@ DECLARE_string(log_dir);
|
||||
#if EXTRA_TESTS
|
||||
#include "unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_pull-in_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc"
|
||||
#endif
|
||||
|
@ -124,7 +124,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||
g1.savetops("FFT_execution_times_extended");
|
||||
g1.savetopdf("FFT_execution_times_extended", 18);
|
||||
g1.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("linespoints");
|
||||
g2.set_title("FFT execution times for different lengths (up to 2^{14}=16384)");
|
||||
@ -136,7 +136,7 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
||||
g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||
g2.savetops("FFT_execution_times");
|
||||
g2.savetopdf("FFT_execution_times", 18);
|
||||
g2.showonscreen(); // window output
|
||||
if (FLAGS_show_plots) g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
|
@ -209,7 +209,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
|
||||
|
||||
g1.savetops("Galileo_E1_acq_grid");
|
||||
g1.savetopdf("Galileo_E1_acq_grid");
|
||||
g1.showonscreen();
|
||||
if (FLAGS_show_plots) g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
|
@ -0,0 +1,900 @@
|
||||
/*!
|
||||
* \file gps_l1_acq_performance_test.cc
|
||||
* \brief This class implements an acquisition performance test
|
||||
* \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.cat
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "test_flags.h"
|
||||
#include "signal_generator_flags.h"
|
||||
#include "tracking_true_obs_reader.h"
|
||||
#include "true_observables_reader.h"
|
||||
#include "display.h"
|
||||
#include "gnuplot_i.h"
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <glog/logging.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test.");
|
||||
DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used.");
|
||||
|
||||
DEFINE_int32(acq_test_doppler_max, 5000, "Maximum Doppler, in Hz");
|
||||
DEFINE_int32(acq_test_doppler_step, 125, "Doppler step, in Hz.");
|
||||
DEFINE_int32(acq_test_coherent_time_ms, 1, "Acquisition coherent time, in ms");
|
||||
DEFINE_int32(acq_test_max_dwells, 1, "Number of non-coherent integrations");
|
||||
DEFINE_bool(acq_test_use_CFAR_algorithm, true, "Use CFAR algorithm");
|
||||
DEFINE_bool(acq_test_bit_transition_flag, false, "Bit transition flag");
|
||||
|
||||
DEFINE_int32(acq_test_signal_duration_s, 2, "Generated signal duration, in s");
|
||||
DEFINE_int32(acq_test_num_meas, 0, "Number of measurements per run. 0 means the complete file.");
|
||||
DEFINE_double(acq_test_cn0_init, 33.0, "Initial CN0, in dBHz.");
|
||||
DEFINE_double(acq_test_cn0_final, 45.0, "Final CN0, in dBHz.");
|
||||
DEFINE_double(acq_test_cn0_step, 3.0, "CN0 step, in dB.");
|
||||
|
||||
DEFINE_double(acq_test_threshold_init, 11.0, "Initial acquisition threshold");
|
||||
DEFINE_double(acq_test_threshold_final, 16.0, "Final acquisition threshold");
|
||||
DEFINE_double(acq_test_threshold_step, 1.0, "Acquisition threshold step");
|
||||
|
||||
DEFINE_double(acq_test_pfa_init, 1e-5, "Set initial threshold via probability of false alarm. Disable with -1.0");
|
||||
|
||||
DEFINE_int32(acq_test_PRN, 1, "PRN number of a present satellite");
|
||||
DEFINE_int32(acq_test_fake_PRN, 33, "PRN number of a non-present satellite");
|
||||
|
||||
DEFINE_int32(acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)");
|
||||
DEFINE_bool(plot_acq_test, false, "Plots results with gnuplot, if available");
|
||||
|
||||
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||
class AcqPerfTest_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<AcqPerfTest_msg_rx> AcqPerfTest_msg_rx_sptr;
|
||||
|
||||
AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue<int>& queue);
|
||||
|
||||
class AcqPerfTest_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue<int>& queue);
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
AcqPerfTest_msg_rx(concurrent_queue<int>& queue);
|
||||
concurrent_queue<int>& channel_internal_queue;
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~AcqPerfTest_msg_rx();
|
||||
};
|
||||
|
||||
|
||||
AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue<int>& queue)
|
||||
{
|
||||
return AcqPerfTest_msg_rx_sptr(new AcqPerfTest_msg_rx(queue));
|
||||
}
|
||||
|
||||
|
||||
void AcqPerfTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
channel_internal_queue.push(rx_message);
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AcqPerfTest_msg_rx::AcqPerfTest_msg_rx(concurrent_queue<int>& queue) : gr::block("AcqPerfTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue)
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&AcqPerfTest_msg_rx::msg_handler_events, this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
|
||||
AcqPerfTest_msg_rx::~AcqPerfTest_msg_rx()
|
||||
{
|
||||
}
|
||||
|
||||
// -----------------------------------------
|
||||
|
||||
|
||||
class AcquisitionPerformanceTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
AcquisitionPerformanceTest()
|
||||
{
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
doppler_max = static_cast<unsigned int>(FLAGS_acq_test_doppler_max);
|
||||
doppler_step = static_cast<unsigned int>(FLAGS_acq_test_doppler_step);
|
||||
stop = false;
|
||||
if (FLAGS_acq_test_input_file.empty())
|
||||
{
|
||||
cn0_vector.push_back(FLAGS_acq_test_cn0_init);
|
||||
double aux = FLAGS_acq_test_cn0_init + FLAGS_acq_test_cn0_step;
|
||||
while (aux <= FLAGS_acq_test_cn0_final)
|
||||
{
|
||||
cn0_vector.push_back(aux);
|
||||
aux = aux + FLAGS_acq_test_cn0_step;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cn0_vector = {0.0};
|
||||
}
|
||||
init();
|
||||
|
||||
if (FLAGS_acq_test_pfa_init > 0.0)
|
||||
{
|
||||
pfa_vector.push_back(FLAGS_acq_test_pfa_init);
|
||||
float aux = 1.0;
|
||||
while ((FLAGS_acq_test_pfa_init * std::pow(10, aux)) < 1)
|
||||
{
|
||||
pfa_vector.push_back(FLAGS_acq_test_pfa_init * std::pow(10, aux));
|
||||
aux = aux + 1.0;
|
||||
}
|
||||
pfa_vector.push_back(1.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
float aux = static_cast<float>(FLAGS_acq_test_threshold_init);
|
||||
pfa_vector.push_back(aux);
|
||||
aux = aux + static_cast<float>(FLAGS_acq_test_threshold_step);
|
||||
while (aux <= static_cast<float>(FLAGS_acq_test_threshold_final))
|
||||
{
|
||||
pfa_vector.push_back(aux);
|
||||
aux = aux + static_cast<float>(FLAGS_acq_test_threshold_step);
|
||||
}
|
||||
}
|
||||
|
||||
num_thresholds = pfa_vector.size();
|
||||
|
||||
int aux2 = ((generated_signal_duration_s * 1000 - FLAGS_acq_test_coherent_time_ms) / FLAGS_acq_test_coherent_time_ms);
|
||||
if ((FLAGS_acq_test_num_meas > 0) and (FLAGS_acq_test_num_meas < aux2))
|
||||
{
|
||||
num_of_measurements = static_cast<unsigned int>(FLAGS_acq_test_num_meas);
|
||||
}
|
||||
else
|
||||
{
|
||||
num_of_measurements = static_cast<unsigned int>(aux2);
|
||||
}
|
||||
|
||||
Pd.resize(cn0_vector.size());
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++) Pd[i].reserve(num_thresholds);
|
||||
Pfa.resize(cn0_vector.size());
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++) Pfa[i].reserve(num_thresholds);
|
||||
Pd_correct.resize(cn0_vector.size());
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++) Pd_correct[i].reserve(num_thresholds);
|
||||
}
|
||||
|
||||
~AcquisitionPerformanceTest()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::vector<double> cn0_vector;
|
||||
std::vector<float> pfa_vector;
|
||||
|
||||
int N_iterations = FLAGS_acq_test_iterations;
|
||||
void init();
|
||||
|
||||
int configure_generator(double cn0);
|
||||
int generate_signal();
|
||||
int configure_receiver(double cn0, float pfa, unsigned int iter);
|
||||
void start_queue();
|
||||
void wait_message();
|
||||
void process_message();
|
||||
void stop_queue();
|
||||
int run_receiver();
|
||||
int count_executions(const std::string& basename, unsigned int sat);
|
||||
void check_results();
|
||||
void plot_results();
|
||||
|
||||
concurrent_queue<int> channel_internal_queue;
|
||||
|
||||
gr::msg_queue::sptr queue;
|
||||
gr::top_block_sptr top_block;
|
||||
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
std::shared_ptr<FileConfiguration> config_f;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
unsigned int doppler_max;
|
||||
unsigned int doppler_step;
|
||||
bool stop;
|
||||
|
||||
int message;
|
||||
boost::thread ch_thread;
|
||||
|
||||
std::string implementation = "GPS_L1_CA_PCPS_Acquisition";
|
||||
|
||||
const double baseband_sampling_freq = static_cast<double>(FLAGS_fs_gen_sps);
|
||||
const int coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms;
|
||||
const int in_acquisition = 1;
|
||||
const int dump_channel = 0;
|
||||
|
||||
int generated_signal_duration_s = FLAGS_acq_test_signal_duration_s;
|
||||
unsigned int num_of_measurements;
|
||||
unsigned int measurement_counter = 0;
|
||||
|
||||
unsigned int observed_satellite = FLAGS_acq_test_PRN;
|
||||
std::string path_str = "./acq-perf-test";
|
||||
|
||||
int num_thresholds;
|
||||
|
||||
std::vector<std::vector<float>> Pd;
|
||||
std::vector<std::vector<float>> Pfa;
|
||||
std::vector<std::vector<float>> Pd_correct;
|
||||
|
||||
private:
|
||||
std::string generator_binary;
|
||||
std::string p1;
|
||||
std::string p2;
|
||||
std::string p3;
|
||||
std::string p4;
|
||||
std::string p5;
|
||||
std::string p6;
|
||||
|
||||
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
|
||||
std::string filename_raw_data = FLAGS_filename_raw_data;
|
||||
|
||||
double compute_stdev_precision(const std::vector<double>& vec);
|
||||
double compute_stdev_accuracy(const std::vector<double>& vec, double ref);
|
||||
};
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::init()
|
||||
{
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
gnss_synchro.PRN = observed_satellite;
|
||||
message = 0;
|
||||
measurement_counter = 0;
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::start_queue()
|
||||
{
|
||||
stop = false;
|
||||
ch_thread = boost::thread(&AcquisitionPerformanceTest::wait_message, this);
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::wait_message()
|
||||
{
|
||||
while (!stop)
|
||||
{
|
||||
channel_internal_queue.wait_and_pop(message);
|
||||
process_message();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::process_message()
|
||||
{
|
||||
measurement_counter++;
|
||||
acquisition->reset();
|
||||
acquisition->set_state(1);
|
||||
std::cout << "Progress: " << round(static_cast<float>(measurement_counter) / static_cast<float>(num_of_measurements) * 100.0) << "% \r" << std::flush;
|
||||
if (measurement_counter == num_of_measurements)
|
||||
{
|
||||
stop_queue();
|
||||
top_block->stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::stop_queue()
|
||||
{
|
||||
stop = true;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::configure_generator(double cn0)
|
||||
{
|
||||
// Configure signal generator
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(std::min(generated_signal_duration_s * 10, 3000));
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps]
|
||||
p6 = std::string("-CN0_dBHz=") + std::to_string(cn0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::generate_signal()
|
||||
{
|
||||
pid_t wait_result;
|
||||
int child_status;
|
||||
std::cout << "Generating signal for " << p6 << "..." << std::endl;
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], &p6[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
perror("fork error");
|
||||
else if (pid == 0)
|
||||
{
|
||||
execv(&generator_binary[0], parmList);
|
||||
std::cout << "Return not expected. Must be an execv error." << std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
wait_result = waitpid(pid, &child_status, 0);
|
||||
if (wait_result == -1) perror("waitpid error");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsigned int iter)
|
||||
{
|
||||
if (FLAGS_config_file_ptest.empty())
|
||||
{
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
const int sampling_rate_internal = baseband_sampling_freq;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal));
|
||||
|
||||
// Set Acquisition
|
||||
config->set_property("Acquisition_1C.implementation", implementation);
|
||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||
config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max));
|
||||
config->set_property("Acquisition_1C.doppler_step", std::to_string(doppler_step));
|
||||
|
||||
config->set_property("Acquisition_1C.threshold", std::to_string(pfa));
|
||||
//if (FLAGS_acq_test_pfa_init > 0.0) config->supersede_property("Acquisition_1C.pfa", std::to_string(pfa));
|
||||
if (FLAGS_acq_test_pfa_init > 0.0)
|
||||
{
|
||||
config->supersede_property("Acquisition_1C.pfa", std::to_string(pfa));
|
||||
}
|
||||
if (FLAGS_acq_test_use_CFAR_algorithm)
|
||||
{
|
||||
config->set_property("Acquisition_1C.use_CFAR_algorithm", "true");
|
||||
}
|
||||
else
|
||||
{
|
||||
config->set_property("Acquisition_1C.use_CFAR_algorithm", "false");
|
||||
}
|
||||
|
||||
config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms));
|
||||
if (FLAGS_acq_test_bit_transition_flag)
|
||||
{
|
||||
config->set_property("Acquisition_1C.bit_transition_flag", "true");
|
||||
}
|
||||
else
|
||||
{
|
||||
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||
}
|
||||
|
||||
config->set_property("Acquisition_1C.max_dwells", std::to_string(FLAGS_acq_test_max_dwells));
|
||||
|
||||
config->set_property("Acquisition_1C.repeat_satellite", "true");
|
||||
|
||||
config->set_property("Acquisition_1C.blocking", "true");
|
||||
config->set_property("Acquisition_1C.make_two_steps", "false");
|
||||
config->set_property("Acquisition_1C.second_nbins", std::to_string(4));
|
||||
config->set_property("Acquisition_1C.second_doppler_step", std::to_string(125));
|
||||
|
||||
config->set_property("Acquisition_1C.dump", "true");
|
||||
std::string dump_file = path_str + std::string("/acquisition_") + std::to_string(cn0) + "_" + std::to_string(iter) + "_" + std::to_string(pfa);
|
||||
config->set_property("Acquisition_1C.dump_filename", dump_file);
|
||||
config->set_property("Acquisition_1C.dump_channel", std::to_string(dump_channel));
|
||||
config->set_property("Acquisition_1C.blocking_on_standby", "true");
|
||||
|
||||
config_f = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
config_f = std::make_shared<FileConfiguration>(FLAGS_config_file_ptest);
|
||||
config = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::run_receiver()
|
||||
{
|
||||
std::string file;
|
||||
if (FLAGS_acq_test_input_file.empty())
|
||||
{
|
||||
file = "./" + filename_raw_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
file = FLAGS_acq_test_input_file;
|
||||
}
|
||||
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();
|
||||
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
boost::shared_ptr<AcqPerfTest_msg_rx> msg_rx = AcqPerfTest_msg_rx_make(channel_internal_queue);
|
||||
|
||||
queue = gr::msg_queue::make(0);
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
init();
|
||||
|
||||
int nsamples = floor(config->property("GNSS-SDR.internal_fs_sps", 2000000) * generated_signal_duration_s);
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
|
||||
acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 0);
|
||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||
acquisition->set_channel(0);
|
||||
acquisition->set_local_code();
|
||||
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||
acquisition->connect(top_block);
|
||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
|
||||
acquisition->init();
|
||||
|
||||
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||
top_block->connect(gr_interleaved_char_to_complex, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
|
||||
start_queue();
|
||||
|
||||
top_block->run(); // Start threads and wait
|
||||
|
||||
#ifdef OLD_BOOST
|
||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||
#endif
|
||||
#ifndef OLD_BOOST
|
||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int AcquisitionPerformanceTest::count_executions(const std::string& basename, unsigned int sat)
|
||||
{
|
||||
FILE* fp;
|
||||
std::string argum2 = std::string("/usr/bin/find ") + path_str + std::string(" -maxdepth 1 -name ") + basename.substr(path_str.length() + 1, basename.length() - path_str.length()) + std::string("* | grep sat_") + std::to_string(sat) + std::string(" | wc -l");
|
||||
char buffer[1024];
|
||||
fp = popen(&argum2[0], "r");
|
||||
int num_executions = 1;
|
||||
if (fp == NULL)
|
||||
{
|
||||
std::cout << "Failed to run command: " << argum2 << std::endl;
|
||||
return 0;
|
||||
}
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||
{
|
||||
std::string aux = std::string(buffer);
|
||||
EXPECT_EQ(aux.empty(), false);
|
||||
num_executions = std::stoi(aux);
|
||||
}
|
||||
pclose(fp);
|
||||
return num_executions;
|
||||
}
|
||||
|
||||
|
||||
void AcquisitionPerformanceTest::plot_results()
|
||||
{
|
||||
if (FLAGS_plot_acq_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);
|
||||
|
||||
Gnuplot g1("linespoints");
|
||||
g1.cmd("set font \"Times,18\"");
|
||||
g1.set_title("Receiver Operating Characteristic for GPS L1 C/A acquisition");
|
||||
g1.cmd("set label 1 \"" + std::string("Coherent integration time: ") + std::to_string(config->property("Acquisition_1C.coherent_integration_time_ms", 1)) + " ms, Non-coherent integrations: " + std::to_string(config->property("Acquisition_1C.max_dwells", 1)) + " \" at screen 0.12, 0.83 font \"Times,16\"");
|
||||
g1.cmd("set logscale x");
|
||||
g1.cmd("set yrange [0:1]");
|
||||
g1.cmd("set xrange[0.0001:1]");
|
||||
g1.cmd("set grid mxtics");
|
||||
g1.cmd("set grid ytics");
|
||||
g1.set_xlabel("Pfa");
|
||||
g1.set_ylabel("Pd");
|
||||
g1.set_grid();
|
||||
g1.cmd("show grid");
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++)
|
||||
{
|
||||
std::vector<float> Pd_i;
|
||||
std::vector<float> Pfa_i;
|
||||
for (int k = 0; k < num_thresholds; k++)
|
||||
{
|
||||
Pd_i.push_back(Pd[i][k]);
|
||||
Pfa_i.push_back(Pfa[i][k]);
|
||||
}
|
||||
g1.plot_xy(Pfa_i, Pd_i, "CN0 = " + std::to_string(static_cast<int>(cn0_vector[i])) + " dBHz");
|
||||
}
|
||||
g1.set_legend();
|
||||
g1.savetops("ROC");
|
||||
g1.savetopdf("ROC", 18);
|
||||
if (FLAGS_show_plots) g1.showonscreen(); // window output
|
||||
|
||||
Gnuplot g2("linespoints");
|
||||
g2.cmd("set font \"Times,18\"");
|
||||
g2.set_title("Receiver Operating Characteristic for GPS L1 C/A valid acquisition");
|
||||
g2.cmd("set label 1 \"" + std::string("Coherent integration time: ") + std::to_string(config->property("Acquisition_1C.coherent_integration_time_ms", 1)) + " ms, Non-coherent integrations: " + std::to_string(config->property("Acquisition_1C.max_dwells", 1)) + " \" at screen 0.12, 0.83 font \"Times,16\"");
|
||||
g2.cmd("set logscale x");
|
||||
g2.cmd("set yrange [0:1]");
|
||||
g2.cmd("set xrange[0.0001:1]");
|
||||
g2.cmd("set grid mxtics");
|
||||
g2.cmd("set grid ytics");
|
||||
g2.set_xlabel("Pfa");
|
||||
g2.set_ylabel("Valid Pd");
|
||||
g2.set_grid();
|
||||
g2.cmd("show grid");
|
||||
for (int i = 0; i < static_cast<int>(cn0_vector.size()); i++)
|
||||
{
|
||||
std::vector<float> Pd_i_correct;
|
||||
std::vector<float> Pfa_i;
|
||||
for (int k = 0; k < num_thresholds; k++)
|
||||
{
|
||||
Pd_i_correct.push_back(Pd_correct[i][k]);
|
||||
Pfa_i.push_back(Pfa[i][k]);
|
||||
}
|
||||
g2.plot_xy(Pfa_i, Pd_i_correct, "CN0 = " + std::to_string(static_cast<int>(cn0_vector[i])) + " dBHz");
|
||||
}
|
||||
g2.set_legend();
|
||||
g2.savetops("ROC-valid-detection");
|
||||
g2.savetopdf("ROC-valid-detection", 18);
|
||||
if (FLAGS_show_plots) g2.showonscreen(); // window output
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_F(AcquisitionPerformanceTest, ROC)
|
||||
{
|
||||
tracking_true_obs_reader true_trk_data;
|
||||
|
||||
if (boost::filesystem::exists(path_str))
|
||||
{
|
||||
boost::filesystem::remove_all(path_str);
|
||||
}
|
||||
boost::system::error_code ec;
|
||||
ASSERT_TRUE(boost::filesystem::create_directory(path_str, ec)) << "Could not create the " << path_str << " folder.";
|
||||
|
||||
unsigned int cn0_index = 0;
|
||||
for (std::vector<double>::const_iterator it = cn0_vector.cbegin(); it != cn0_vector.cend(); ++it)
|
||||
{
|
||||
std::vector<double> meas_Pd_;
|
||||
std::vector<double> meas_Pd_correct_;
|
||||
std::vector<double> meas_Pfa_;
|
||||
|
||||
if (FLAGS_acq_test_input_file.empty()) std::cout << "Execution for CN0 = " << *it << " dB-Hz" << std::endl;
|
||||
|
||||
// Do N_iterations of the experiment
|
||||
for (int pfa_iter = 0; pfa_iter < static_cast<int>(pfa_vector.size()); pfa_iter++)
|
||||
{
|
||||
if (FLAGS_acq_test_pfa_init > 0.0)
|
||||
{
|
||||
std::cout << "Setting threshold for Pfa = " << pfa_vector[pfa_iter] << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Setting threshold to " << pfa_vector[pfa_iter] << std::endl;
|
||||
}
|
||||
|
||||
// Configure the signal generator
|
||||
if (FLAGS_acq_test_input_file.empty()) configure_generator(*it);
|
||||
|
||||
for (int iter = 0; iter < N_iterations; iter++)
|
||||
{
|
||||
// Generate signal raw signal samples and observations RINEX file
|
||||
if (FLAGS_acq_test_input_file.empty()) generate_signal();
|
||||
|
||||
for (unsigned k = 0; k < 2; k++)
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
observed_satellite = FLAGS_acq_test_PRN;
|
||||
}
|
||||
else
|
||||
{
|
||||
observed_satellite = FLAGS_acq_test_fake_PRN;
|
||||
}
|
||||
init();
|
||||
|
||||
// Configure the receiver
|
||||
configure_receiver(*it, pfa_vector[pfa_iter], iter);
|
||||
|
||||
// Run it
|
||||
run_receiver();
|
||||
|
||||
// count executions
|
||||
std::string basename = path_str + std::string("/acquisition_") + std::to_string(*it) + "_" + std::to_string(iter) + "_" + std::to_string(pfa_vector[pfa_iter]) + "_" + gnss_synchro.System + "_1C";
|
||||
int num_executions = count_executions(basename, observed_satellite);
|
||||
|
||||
// Read measured data
|
||||
int ch = config->property("Acquisition_1C.dump_channel", 0);
|
||||
arma::vec meas_timestamp_s = arma::zeros(num_executions, 1);
|
||||
arma::vec meas_doppler = arma::zeros(num_executions, 1);
|
||||
arma::vec positive_acq = arma::zeros(num_executions, 1);
|
||||
arma::vec meas_acq_delay_chips = arma::zeros(num_executions, 1);
|
||||
|
||||
double coh_time_ms = config->property("Acquisition_1C.coherent_integration_time_ms", 1);
|
||||
|
||||
std::cout << "Num executions: " << num_executions << std::endl;
|
||||
for (int execution = 1; execution <= num_executions; execution++)
|
||||
{
|
||||
acquisition_dump_reader acq_dump(basename, observed_satellite, config->property("Acquisition_1C.doppler_max", 0), config->property("Acquisition_1C.doppler_step", 0), config->property("GNSS-SDR.internal_fs_sps", 0) * GPS_L1_CA_CODE_PERIOD * static_cast<double>(coh_time_ms), ch, execution);
|
||||
acq_dump.read_binary_acq();
|
||||
if (acq_dump.positive_acq)
|
||||
{
|
||||
//std::cout << "Meas acq_delay_samples: " << acq_dump.acq_delay_samples << " chips: " << acq_dump.acq_delay_samples / (baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD / GPS_L1_CA_CODE_LENGTH_CHIPS) << std::endl;
|
||||
meas_timestamp_s(execution - 1) = acq_dump.sample_counter / baseband_sampling_freq;
|
||||
meas_doppler(execution - 1) = acq_dump.acq_doppler_hz;
|
||||
meas_acq_delay_chips(execution - 1) = acq_dump.acq_delay_samples / (baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD / GPS_L1_CA_CODE_LENGTH_CHIPS);
|
||||
positive_acq(execution - 1) = acq_dump.positive_acq;
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "Failed acquisition." << std::endl;
|
||||
meas_timestamp_s(execution - 1) = arma::datum::inf;
|
||||
meas_doppler(execution - 1) = arma::datum::inf;
|
||||
meas_acq_delay_chips(execution - 1) = arma::datum::inf;
|
||||
positive_acq(execution - 1) = acq_dump.positive_acq;
|
||||
}
|
||||
}
|
||||
|
||||
// Read reference data
|
||||
std::string true_trk_file = std::string("./gps_l1_ca_obs_prn");
|
||||
true_trk_file.append(std::to_string(observed_satellite));
|
||||
true_trk_file.append(".dat");
|
||||
true_trk_data.close_obs_file();
|
||||
true_trk_data.open_obs_file(true_trk_file);
|
||||
|
||||
// load the true values
|
||||
long int n_true_epochs = true_trk_data.num_epochs();
|
||||
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);
|
||||
|
||||
long int epoch_counter = 0;
|
||||
int num_clean_executions = 0;
|
||||
while (true_trk_data.read_binary_obs())
|
||||
{
|
||||
true_timestamp_s(epoch_counter) = true_trk_data.signal_timestamp_s;
|
||||
true_acc_carrier_phase_cycles(epoch_counter) = true_trk_data.acc_carrier_phase_cycles;
|
||||
true_Doppler_Hz(epoch_counter) = true_trk_data.doppler_l1_hz;
|
||||
true_prn_delay_chips(epoch_counter) = GPS_L1_CA_CODE_LENGTH_CHIPS - true_trk_data.prn_delay_chips;
|
||||
true_tow_s(epoch_counter) = true_trk_data.tow;
|
||||
epoch_counter++;
|
||||
//std::cout << "True PRN_Delay chips = " << GPS_L1_CA_CODE_LENGTH_CHIPS - true_trk_data.prn_delay_chips << " at " << true_trk_data.signal_timestamp_s << std::endl;
|
||||
}
|
||||
|
||||
// Process results
|
||||
arma::vec clean_doppler_estimation_error;
|
||||
arma::vec clean_delay_estimation_error;
|
||||
|
||||
if (epoch_counter > 2)
|
||||
{
|
||||
arma::vec true_interpolated_doppler = arma::zeros(num_executions, 1);
|
||||
arma::vec true_interpolated_prn_delay_chips = arma::zeros(num_executions, 1);
|
||||
interp1(true_timestamp_s, true_Doppler_Hz, meas_timestamp_s, true_interpolated_doppler);
|
||||
interp1(true_timestamp_s, true_prn_delay_chips, meas_timestamp_s, true_interpolated_prn_delay_chips);
|
||||
|
||||
arma::vec doppler_estimation_error = true_interpolated_doppler - meas_doppler;
|
||||
arma::vec delay_estimation_error = true_interpolated_prn_delay_chips - (meas_acq_delay_chips - ((1.0 / baseband_sampling_freq) / GPS_L1_CA_CHIP_PERIOD)); // compensate 1 sample delay
|
||||
|
||||
// Cut measurements without reference
|
||||
for (int i = 0; i < num_executions; i++)
|
||||
{
|
||||
if (!std::isnan(doppler_estimation_error(i)) and !std::isnan(delay_estimation_error(i)))
|
||||
{
|
||||
num_clean_executions++;
|
||||
}
|
||||
}
|
||||
clean_doppler_estimation_error = arma::zeros(num_clean_executions, 1);
|
||||
clean_delay_estimation_error = arma::zeros(num_clean_executions, 1);
|
||||
num_clean_executions = 0;
|
||||
for (int i = 0; i < num_executions; i++)
|
||||
{
|
||||
if (!std::isnan(doppler_estimation_error(i)) and !std::isnan(delay_estimation_error(i)))
|
||||
{
|
||||
clean_doppler_estimation_error(num_clean_executions) = doppler_estimation_error(i);
|
||||
clean_delay_estimation_error(num_clean_executions) = delay_estimation_error(i);
|
||||
num_clean_executions++;
|
||||
}
|
||||
}
|
||||
|
||||
/* std::cout << "Doppler estimation error [Hz]: ";
|
||||
for (int i = 0; i < num_executions - 1; i++)
|
||||
{
|
||||
std::cout << doppler_estimation_error(i) << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << "Delay estimation error [chips]: ";
|
||||
for (int i = 0; i < num_executions - 1; i++)
|
||||
{
|
||||
std::cout << delay_estimation_error(i) << " ";
|
||||
|
||||
}
|
||||
std::cout << std::endl; */
|
||||
}
|
||||
if (k == 0)
|
||||
{
|
||||
double detected = arma::accu(positive_acq);
|
||||
double computed_Pd = detected / static_cast<double>(num_executions);
|
||||
if (num_executions > 0)
|
||||
{
|
||||
meas_Pd_.push_back(computed_Pd);
|
||||
}
|
||||
else
|
||||
{
|
||||
meas_Pd_.push_back(0.0);
|
||||
}
|
||||
std::cout << TEXT_BOLD_BLACK << "Probability of detection for channel=" << ch << ", CN0=" << *it << " dBHz"
|
||||
<< ": " << (num_executions > 0 ? computed_Pd : 0.0) << TEXT_RESET << std::endl;
|
||||
}
|
||||
if (num_clean_executions > 0)
|
||||
{
|
||||
arma::vec correct_acq = arma::zeros(num_executions, 1);
|
||||
double correctly_detected = 0.0;
|
||||
for (int i = 0; i < num_clean_executions - 1; i++)
|
||||
|
||||
{
|
||||
if (abs(clean_delay_estimation_error(i)) < 0.5 and abs(clean_doppler_estimation_error(i)) < static_cast<float>(config->property("Acquisition_1C.doppler_step", 1)) / 2.0)
|
||||
{
|
||||
correctly_detected = correctly_detected + 1.0;
|
||||
}
|
||||
}
|
||||
double computed_Pd_correct = correctly_detected / static_cast<double>(num_clean_executions);
|
||||
meas_Pd_correct_.push_back(computed_Pd_correct);
|
||||
std::cout << TEXT_BOLD_BLACK << "Probability of correct detection for channel=" << ch << ", CN0=" << *it << " dBHz"
|
||||
<< ": " << computed_Pd_correct << TEXT_RESET << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "No reference data has been found. Maybe a non-present satellite?" << num_executions << std::endl;
|
||||
if (k == 1)
|
||||
{
|
||||
double wrongly_detected = arma::accu(positive_acq);
|
||||
double computed_Pfa = wrongly_detected / static_cast<double>(num_executions);
|
||||
if (num_executions > 0)
|
||||
{
|
||||
meas_Pfa_.push_back(computed_Pfa);
|
||||
}
|
||||
else
|
||||
{
|
||||
meas_Pfa_.push_back(0.0);
|
||||
}
|
||||
std::cout << TEXT_BOLD_BLACK << "Probability of false alarm for channel=" << ch << ", CN0=" << *it << " dBHz"
|
||||
<< ": " << (num_executions > 0 ? computed_Pfa : 0.0) << TEXT_RESET << std::endl;
|
||||
}
|
||||
}
|
||||
true_trk_data.restart();
|
||||
}
|
||||
}
|
||||
true_trk_data.close_obs_file();
|
||||
float sum_pd = static_cast<float>(std::accumulate(meas_Pd_.begin(), meas_Pd_.end(), 0.0));
|
||||
float sum_pd_correct = static_cast<float>(std::accumulate(meas_Pd_correct_.begin(), meas_Pd_correct_.end(), 0.0));
|
||||
float sum_pfa = static_cast<float>(std::accumulate(meas_Pfa_.begin(), meas_Pfa_.end(), 0.0));
|
||||
if (meas_Pd_.size() > 0 and meas_Pfa_.size() > 0)
|
||||
{
|
||||
Pd[cn0_index][pfa_iter] = sum_pd / static_cast<float>(meas_Pd_.size());
|
||||
Pfa[cn0_index][pfa_iter] = sum_pfa / static_cast<float>(meas_Pfa_.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (meas_Pd_.size() > 0)
|
||||
{
|
||||
Pd[cn0_index][pfa_iter] = sum_pd / static_cast<float>(meas_Pd_.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
Pd[cn0_index][pfa_iter] = 0.0;
|
||||
}
|
||||
if (meas_Pfa_.size() > 0)
|
||||
{
|
||||
Pfa[cn0_index][pfa_iter] = sum_pfa / static_cast<float>(meas_Pfa_.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
Pfa[cn0_index][pfa_iter] = 0.0;
|
||||
}
|
||||
}
|
||||
if (meas_Pd_correct_.size() > 0)
|
||||
{
|
||||
Pd_correct[cn0_index][pfa_iter] = sum_pd_correct / static_cast<float>(meas_Pd_correct_.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
Pd_correct[cn0_index][pfa_iter] = 0.0;
|
||||
}
|
||||
meas_Pd_.clear();
|
||||
meas_Pfa_.clear();
|
||||
meas_Pd_correct_.clear();
|
||||
}
|
||||
cn0_index++;
|
||||
}
|
||||
|
||||
// Compute results
|
||||
unsigned int aux_index = 0;
|
||||
for (std::vector<double>::const_iterator it = cn0_vector.cbegin(); it != cn0_vector.cend(); ++it)
|
||||
{
|
||||
std::cout << "Results for CN0 = " << *it << " dBHz:" << std::endl;
|
||||
std::cout << "Pd = ";
|
||||
for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++)
|
||||
{
|
||||
std::cout << Pd[aux_index][pfa_iter] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << "Pd_correct = ";
|
||||
for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++)
|
||||
{
|
||||
std::cout << Pd_correct[aux_index][pfa_iter] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
std::cout << "Pfa = ";
|
||||
for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++)
|
||||
{
|
||||
std::cout << Pfa[aux_index][pfa_iter] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
aux_index++;
|
||||
}
|
||||
|
||||
plot_results();
|
||||
}
|
@ -160,6 +160,7 @@ void GpsL1CaPcpsAcquisitionTest::init()
|
||||
config->set_property("Acquisition_1C.dump", "false");
|
||||
}
|
||||
config->set_property("Acquisition_1C.dump_filename", "./tmp-acq-gps1/acquisition");
|
||||
config->set_property("Acquisition_1C.dump_channel", "1");
|
||||
config->set_property("Acquisition_1C.threshold", "0.00001");
|
||||
config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max));
|
||||
config->set_property("Acquisition_1C.doppler_step", std::to_string(doppler_step));
|
||||
@ -175,7 +176,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !!
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code, 1);
|
||||
|
||||
if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
|
||||
@ -209,7 +210,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||
|
||||
g1.savetops("GPS_L1_acq_grid");
|
||||
g1.savetopdf("GPS_L1_acq_grid");
|
||||
g1.showonscreen();
|
||||
if (FLAGS_show_plots) g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException &ge)
|
||||
{
|
||||
|
@ -163,7 +163,8 @@ void GpsL2MPcpsAcquisitionTest::init()
|
||||
{
|
||||
config->set_property("Acquisition_2S.dump", "false");
|
||||
}
|
||||
config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition");
|
||||
config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition_test");
|
||||
config->set_property("Acquisition_2S.dump_channel", "1");
|
||||
config->set_property("Acquisition_2S.threshold", "0.001");
|
||||
config->set_property("Acquisition_2S.doppler_max", std::to_string(doppler_max));
|
||||
config->set_property("Acquisition_2S.doppler_step", std::to_string(doppler_step));
|
||||
@ -175,11 +176,11 @@ void GpsL2MPcpsAcquisitionTest::init()
|
||||
void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||
{
|
||||
//load the measured values
|
||||
std::string basename = "./tmp-acq-gps2/acquisition_G_2S";
|
||||
std::string basename = "./tmp-acq-gps2/acquisition_test_G_2S";
|
||||
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||
|
||||
unsigned int samples_per_code = static_cast<unsigned int>(floor(static_cast<double>(sampling_frequency_hz) / (GPS_L2_M_CODE_RATE_HZ / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS))));
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code, 1);
|
||||
if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||
|
||||
std::vector<int> *doppler = &acq_dump.doppler;
|
||||
@ -212,7 +213,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||
|
||||
g1.savetops("GPS_L2CM_acq_grid");
|
||||
g1.savetopdf("GPS_L2CM_acq_grid");
|
||||
g1.showonscreen();
|
||||
if (FLAGS_show_plots) g1.showonscreen();
|
||||
}
|
||||
catch (const GnuplotException &ge)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "grid");
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "acq_grid");
|
||||
if (var_ == NULL)
|
||||
{
|
||||
std::cout << "¡¡¡Unreachable grid variable into Acquisition dump file!!!" << std::endl;
|
||||
@ -73,16 +73,56 @@ bool acquisition_dump_reader::read_binary_acq()
|
||||
Mat_Close(matfile);
|
||||
return false;
|
||||
}
|
||||
matvar_t* var2_ = Mat_VarRead(matfile, "doppler_max");
|
||||
d_doppler_max = *static_cast<unsigned int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "doppler_step");
|
||||
d_doppler_step = *static_cast<unsigned int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "input_power");
|
||||
input_power = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "acq_doppler_hz");
|
||||
acq_doppler_hz = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "acq_delay_samples");
|
||||
acq_delay_samples = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "test_statistic");
|
||||
test_statistic = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "threshold");
|
||||
threshold = *static_cast<float*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "sample_counter");
|
||||
sample_counter = *static_cast<long unsigned int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "d_positive_acq");
|
||||
positive_acq = *static_cast<int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
var2_ = Mat_VarRead(matfile, "PRN");
|
||||
PRN = *static_cast<int*>(var2_->data);
|
||||
Mat_VarFree(var2_);
|
||||
|
||||
std::vector<std::vector<float> >::iterator it1;
|
||||
std::vector<float>::iterator it2;
|
||||
float* aux = static_cast<float*>(var_->data);
|
||||
int k = 0;
|
||||
float normalization_factor = std::pow(d_samples_per_code, 2);
|
||||
float normalization_factor = std::pow(d_samples_per_code, 4) * input_power;
|
||||
for (it1 = mag.begin(); it1 != mag.end(); it1++)
|
||||
{
|
||||
for (it2 = it1->begin(); it2 != it1->end(); it2++)
|
||||
{
|
||||
*it2 = static_cast<float>(std::sqrt(aux[k])) / normalization_factor;
|
||||
*it2 = static_cast<float>(aux[k]) / normalization_factor;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
@ -93,17 +133,74 @@ 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,
|
||||
int channel,
|
||||
int execution)
|
||||
{
|
||||
unsigned int sat_ = 0;
|
||||
unsigned int doppler_max_ = 0;
|
||||
unsigned int doppler_step_ = 0;
|
||||
unsigned int samples_per_code_ = 0;
|
||||
|
||||
mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY);
|
||||
if (matfile != NULL)
|
||||
{
|
||||
matvar_t* var_ = Mat_VarRead(matfile, "doppler_max");
|
||||
doppler_max_ = *static_cast<unsigned int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "doppler_step");
|
||||
doppler_step_ = *static_cast<unsigned int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "PRN");
|
||||
sat_ = *static_cast<int*>(var_->data);
|
||||
Mat_VarFree(var_);
|
||||
|
||||
var_ = Mat_VarRead(matfile, "grid");
|
||||
samples_per_code_ = var_->dims[0];
|
||||
Mat_VarFree(var_);
|
||||
|
||||
Mat_Close(matfile);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl;
|
||||
}
|
||||
acquisition_dump_reader(basename,
|
||||
sat_,
|
||||
doppler_max_,
|
||||
doppler_step_,
|
||||
samples_per_code_,
|
||||
channel,
|
||||
execution);
|
||||
}
|
||||
|
||||
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;
|
||||
d_doppler_max = doppler_max;
|
||||
d_doppler_step = doppler_step;
|
||||
d_samples_per_code = samples_per_code;
|
||||
acq_doppler_hz = 0.0;
|
||||
acq_delay_samples = 0.0;
|
||||
test_statistic = 0.0;
|
||||
input_power = 0.0;
|
||||
threshold = 0.0;
|
||||
positive_acq = 0;
|
||||
sample_counter = 0;
|
||||
PRN = 0;
|
||||
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,13 +38,33 @@
|
||||
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(const std::string& basename,
|
||||
int channel = 0,
|
||||
int execution = 1);
|
||||
|
||||
~acquisition_dump_reader();
|
||||
|
||||
bool read_binary_acq();
|
||||
|
||||
std::vector<int> doppler;
|
||||
std::vector<unsigned int> samples;
|
||||
std::vector<std::vector<float> > mag;
|
||||
float acq_doppler_hz;
|
||||
float acq_delay_samples;
|
||||
float test_statistic;
|
||||
float input_power;
|
||||
float threshold;
|
||||
int positive_acq;
|
||||
unsigned int PRN;
|
||||
long unsigned int sample_counter;
|
||||
|
||||
private:
|
||||
std::string d_basename;
|
||||
|
@ -97,7 +97,6 @@ bool observables_dump_reader::open_obs_file(std::string out_file)
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Observables sum file opened, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
@ -112,6 +111,13 @@ bool observables_dump_reader::open_obs_file(std::string out_file)
|
||||
}
|
||||
}
|
||||
|
||||
void observables_dump_reader::close_obs_file()
|
||||
{
|
||||
if (d_dump_file.is_open() == false)
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
observables_dump_reader::observables_dump_reader(int n_channels_)
|
||||
{
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
bool restart();
|
||||
long int num_epochs();
|
||||
bool open_obs_file(std::string out_file);
|
||||
void close_obs_file();
|
||||
|
||||
|
||||
//dump variables
|
||||
|
@ -109,7 +109,6 @@ bool tracking_dump_reader::open_obs_file(std::string out_file)
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Tracking dump enabled, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
|
@ -89,15 +89,15 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file)
|
||||
{
|
||||
try
|
||||
{
|
||||
d_dump_file.clear();
|
||||
d_dump_filename = out_file;
|
||||
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
|
||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary);
|
||||
std::cout << "Observables dump enabled, Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
return true;
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
std::cout << "Problem opening Observables dump Log file: " << d_dump_filename.c_str() << std::endl;
|
||||
std::cout << "Problem opening Tracking dump Log file: " << d_dump_filename.c_str() << " Error: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -107,6 +107,13 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file)
|
||||
}
|
||||
}
|
||||
|
||||
void tracking_true_obs_reader::close_obs_file()
|
||||
{
|
||||
if (d_dump_file.is_open() == true)
|
||||
{
|
||||
d_dump_file.close();
|
||||
}
|
||||
}
|
||||
|
||||
tracking_true_obs_reader::~tracking_true_obs_reader()
|
||||
{
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
bool restart();
|
||||
long int num_epochs();
|
||||
bool open_obs_file(std::string out_file);
|
||||
void close_obs_file();
|
||||
bool d_dump;
|
||||
|
||||
double signal_timestamp_s;
|
||||
|
@ -293,7 +293,7 @@ void GpsL1CATelemetryDecoderTest::check_results(arma::vec& true_time_s,
|
||||
|
||||
//2. RMSE
|
||||
//arma::vec err = meas_value - true_value_interp + 0.001;
|
||||
arma::vec err = meas_value - true_value_interp - 0.001;
|
||||
arma::vec err = meas_value - true_value_interp; // - 0.001;
|
||||
|
||||
arma::vec err2 = arma::square(err);
|
||||
double rmse = sqrt(arma::mean(err2));
|
||||
|
@ -0,0 +1,573 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_dll_pll_tracking_test.cc
|
||||
* \brief This class implements a tracking Pull-In test for GPS_L1_CA_DLL_PLL_Tracking
|
||||
* implementation based on some input parameters.
|
||||
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2012-2018 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
#include <armadillo>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/interleaved_char_to_complex.h>
|
||||
#include <gnuradio/blocks/null_sink.h>
|
||||
#include <gnuradio/blocks/skiphead.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "GPS_L1_CA.h"
|
||||
#include "gnss_block_factory.h"
|
||||
#include "tracking_interface.h"
|
||||
#include "in_memory_configuration.h"
|
||||
#include "tracking_true_obs_reader.h"
|
||||
#include "tracking_dump_reader.h"
|
||||
#include "signal_generator_flags.h"
|
||||
#include "gnuplot_i.h"
|
||||
#include "test_flags.h"
|
||||
#include "tracking_tests_flags.h"
|
||||
|
||||
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||
class GpsL1CADllPllTrackingPullInTest_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<GpsL1CADllPllTrackingPullInTest_msg_rx> GpsL1CADllPllTrackingPullInTest_msg_rx_sptr;
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make();
|
||||
|
||||
class GpsL1CADllPllTrackingPullInTest_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx();
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CADllPllTrackingPullInTest_msg_rx(); //!< Default destructor
|
||||
};
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make()
|
||||
{
|
||||
return GpsL1CADllPllTrackingPullInTest_msg_rx_sptr(new GpsL1CADllPllTrackingPullInTest_msg_rx());
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingPullInTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message; //3 -> loss of lock
|
||||
//std::cout << "Received trk message: " << rx_message << std::endl;
|
||||
}
|
||||
catch (boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx::GpsL1CADllPllTrackingPullInTest_msg_rx() : gr::block("GpsL1CADllPllTrackingPullInTest_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(&GpsL1CADllPllTrackingPullInTest_msg_rx::msg_handler_events, this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest_msg_rx::~GpsL1CADllPllTrackingPullInTest_msg_rx()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GpsL1CADllPllTrackingPullInTest : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
std::string generator_binary;
|
||||
std::string p1;
|
||||
std::string p2;
|
||||
std::string p3;
|
||||
std::string p4;
|
||||
std::string p5;
|
||||
std::string p6;
|
||||
std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; //"GPS_L1_CA_DLL_PLL_C_Aid_Tracking";
|
||||
|
||||
const int baseband_sampling_freq = FLAGS_fs_gen_sps;
|
||||
|
||||
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
|
||||
std::string filename_raw_data = FLAGS_filename_raw_data;
|
||||
|
||||
int configure_generator(double CN0_dBHz, int file_idx);
|
||||
int generate_signal();
|
||||
std::vector<double> check_results_doppler(arma::vec& true_time_s,
|
||||
arma::vec& true_value,
|
||||
arma::vec& meas_time_s,
|
||||
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,
|
||||
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,
|
||||
double& mean_error,
|
||||
double& std_dev_error);
|
||||
|
||||
GpsL1CADllPllTrackingPullInTest()
|
||||
{
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
}
|
||||
|
||||
~GpsL1CADllPllTrackingPullInTest()
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
};
|
||||
|
||||
|
||||
int GpsL1CADllPllTrackingPullInTest::configure_generator(double CN0_dBHz, int file_idx)
|
||||
{
|
||||
// Configure signal generator
|
||||
generator_binary = FLAGS_generator_binary;
|
||||
|
||||
p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file;
|
||||
if (FLAGS_dynamic_position.empty())
|
||||
{
|
||||
p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(FLAGS_duration * 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position);
|
||||
}
|
||||
p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output
|
||||
p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples
|
||||
p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps]
|
||||
p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int GpsL1CADllPllTrackingPullInTest::generate_signal()
|
||||
{
|
||||
int child_status;
|
||||
|
||||
char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], &p6[0], NULL};
|
||||
|
||||
int pid;
|
||||
if ((pid = fork()) == -1)
|
||||
perror("fork err");
|
||||
else if (pid == 0)
|
||||
{
|
||||
execv(&generator_binary[0], parmList);
|
||||
std::cout << "Return not expected. Must be an execv err." << std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
waitpid(pid, &child_status, 0);
|
||||
|
||||
std::cout << "Signal and Observables RINEX and RAW files created." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CADllPllTrackingPullInTest::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';
|
||||
std::string signal = "1C";
|
||||
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", 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(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";
|
||||
}
|
||||
|
||||
|
||||
TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults)
|
||||
{
|
||||
//*************************************************
|
||||
//***** STEP 2: Prepare the parameters sweep ******
|
||||
//*************************************************
|
||||
std::vector<double> acq_doppler_error_hz_values;
|
||||
std::vector<std::vector<double>> acq_delay_error_chips_values; //vector of vector
|
||||
|
||||
for (double doppler_hz = FLAGS_Acq_Doppler_error_hz_start; doppler_hz >= FLAGS_Acq_Doppler_error_hz_stop; doppler_hz = doppler_hz + FLAGS_Acq_Doppler_error_hz_step)
|
||||
{
|
||||
acq_doppler_error_hz_values.push_back(doppler_hz);
|
||||
std::vector<double> tmp_vector;
|
||||
//Code Delay Sweep
|
||||
for (double code_delay_chips = FLAGS_Acq_Delay_error_chips_start; code_delay_chips >= FLAGS_Acq_Delay_error_chips_stop; code_delay_chips = code_delay_chips + FLAGS_Acq_Delay_error_chips_step)
|
||||
{
|
||||
tmp_vector.push_back(code_delay_chips);
|
||||
}
|
||||
acq_delay_error_chips_values.push_back(tmp_vector);
|
||||
}
|
||||
|
||||
|
||||
//*********************************************
|
||||
//***** STEP 3: Generate the input signal *****
|
||||
//*********************************************
|
||||
std::vector<double> generator_CN0_values;
|
||||
if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop)
|
||||
{
|
||||
generator_CN0_values.push_back(FLAGS_CN0_dBHz_start);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (double cn0 = FLAGS_CN0_dBHz_start; cn0 > FLAGS_CN0_dBHz_stop; cn0 = cn0 - FLAGS_CN0_dB_step)
|
||||
{
|
||||
generator_CN0_values.push_back(cn0);
|
||||
}
|
||||
}
|
||||
|
||||
// use generator or use an external capture file
|
||||
if (FLAGS_enable_external_signal_file)
|
||||
{
|
||||
//todo: create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||
{
|
||||
// Configure the signal generator
|
||||
configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx);
|
||||
// Generate signal raw signal samples and observations RINEX file
|
||||
if (FLAGS_disable_generator == false)
|
||||
{
|
||||
generate_signal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
configure_receiver(FLAGS_PLL_bw_hz_start,
|
||||
FLAGS_DLL_bw_hz_start,
|
||||
FLAGS_PLL_narrow_bw_hz,
|
||||
FLAGS_DLL_narrow_bw_hz,
|
||||
FLAGS_extend_correlation_symbols);
|
||||
|
||||
//******************************************************************************************
|
||||
//***** Obtain the initial signal sinchronization parameters (emulating an acquisition) ****
|
||||
//******************************************************************************************
|
||||
int test_satellite_PRN = 0;
|
||||
tracking_true_obs_reader true_obs_data;
|
||||
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 << "True Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " rue Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
//todo: Simulate a perfect acquisition for the external capture file
|
||||
}
|
||||
//CN0 LOOP
|
||||
std::vector<std::vector<double>> pull_in_results_v_v;
|
||||
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||
{
|
||||
std::vector<double> pull_in_results_v;
|
||||
for (unsigned int current_acq_doppler_error_idx = 0; current_acq_doppler_error_idx < acq_doppler_error_hz_values.size(); current_acq_doppler_error_idx++)
|
||||
{
|
||||
for (unsigned int current_acq_code_error_idx = 0; current_acq_code_error_idx < acq_delay_error_chips_values.at(current_acq_doppler_error_idx).size(); current_acq_code_error_idx++)
|
||||
{
|
||||
//simulate a Doppler error in acquisition
|
||||
double acq_doppler_hz = true_obs_data.doppler_l1_hz + acq_doppler_error_hz_values.at(current_acq_doppler_error_idx);
|
||||
//simulate Code Delay error in acquisition
|
||||
double acq_delay_samples;
|
||||
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;
|
||||
acq_delay_samples += (acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx) / GPS_L1_CA_CODE_RATE_HZ) * static_cast<double>(baseband_sampling_freq);
|
||||
|
||||
//create flowgraph
|
||||
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<GpsL1CADllPllTrackingPullInTest_msg_rx> msg_rx = GpsL1CADllPllTrackingPullInTest_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 *****
|
||||
//********************************************************************
|
||||
std::cout << "------------ START TRACKING -------------" << std::endl;
|
||||
tracking->start_tracking();
|
||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||
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;
|
||||
|
||||
|
||||
pull_in_results_v.push_back(msg_rx->rx_message != 3); //save last asynchronous tracking message in order to detect a loss of lock
|
||||
|
||||
//********************************
|
||||
//***** STEP 7: Plot results *****
|
||||
//********************************
|
||||
if (FLAGS_plot_gps_l1_tracking_test == true)
|
||||
{
|
||||
//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();
|
||||
//todo: use vectors instead
|
||||
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);
|
||||
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;
|
||||
long int epoch_counter = 0;
|
||||
while (trk_dump.read_binary_obs())
|
||||
{
|
||||
trk_timestamp_s(epoch_counter) = static_cast<double>(trk_dump.PRN_start_sample_count) / static_cast<double>(baseband_sampling_freq);
|
||||
trk_acc_carrier_phase_cycles(epoch_counter) = trk_dump.acc_carrier_phase_rad / GPS_TWO_PI;
|
||||
trk_Doppler_Hz(epoch_counter) = trk_dump.carrier_doppler_hz;
|
||||
double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS * (fmod((static_cast<double>(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast<double>(baseband_sampling_freq), 1.0e-3) / 1.0e-3);
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
|
||||
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_detail_level >= 2)
|
||||
{
|
||||
Gnuplot g1("linespoints");
|
||||
if (FLAGS_show_plots) 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(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " 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, prompt, "Prompt", decimate);
|
||||
g1.plot_xy(trk_timestamp_s, early, "Early", decimate);
|
||||
g1.plot_xy(trk_timestamp_s, late, "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");
|
||||
if (FLAGS_show_plots) g2.showonscreen(); // window output
|
||||
g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " 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, promptQ);
|
||||
//g2.savetops("Constellation");
|
||||
//g2.savetopdf("Constellation", 18);
|
||||
|
||||
Gnuplot g3("linespoints");
|
||||
g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, 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");
|
||||
|
||||
g3.plot_xy(trk_timestamp_s, CN0_dBHz,
|
||||
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);
|
||||
if (FLAGS_show_plots) g3.showonscreen(); // window output
|
||||
}
|
||||
}
|
||||
catch (const GnuplotException& ge)
|
||||
{
|
||||
std::cout << ge.what() << std::endl;
|
||||
}
|
||||
}
|
||||
} //end plot
|
||||
|
||||
} //end acquisition Delay errors loop
|
||||
} //end acquisition Doppler errors loop
|
||||
pull_in_results_v_v.push_back(pull_in_results_v);
|
||||
|
||||
|
||||
} //end CN0 LOOP
|
||||
//build the mesh grid
|
||||
std::vector<double> doppler_error_mesh;
|
||||
std::vector<double> code_delay_error_mesh;
|
||||
for (unsigned int current_acq_doppler_error_idx = 0; current_acq_doppler_error_idx < acq_doppler_error_hz_values.size(); current_acq_doppler_error_idx++)
|
||||
{
|
||||
for (unsigned int current_acq_code_error_idx = 0; current_acq_code_error_idx < acq_delay_error_chips_values.at(current_acq_doppler_error_idx).size(); current_acq_code_error_idx++)
|
||||
{
|
||||
doppler_error_mesh.push_back(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx));
|
||||
code_delay_error_mesh.push_back(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx));
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++)
|
||||
{
|
||||
std::vector<double> pull_in_result_mesh;
|
||||
pull_in_result_mesh = pull_in_results_v_v.at(current_cn0_idx);
|
||||
//plot grid
|
||||
Gnuplot g4("points palette pointsize 2 pointtype 7");
|
||||
g4.cmd("set palette defined ( 0 \"black\", 1 \"green\" )");
|
||||
g4.cmd("set key off");
|
||||
g4.cmd("set view map");
|
||||
std::string title("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))) + " dB-Hz, PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " Hz.");
|
||||
g4.set_title(title);
|
||||
g4.set_grid();
|
||||
g4.set_xlabel("Acquisition Doppler error [Hz]");
|
||||
g4.set_ylabel("Acquisition Code Delay error [Chips]");
|
||||
|
||||
g4.plot_xyz(doppler_error_mesh,
|
||||
code_delay_error_mesh,
|
||||
pull_in_result_mesh);
|
||||
g4.set_legend();
|
||||
g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))));
|
||||
g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast<int>(round(generator_CN0_values.at(current_cn0_idx)))), 12);
|
||||
if (FLAGS_show_plots) g4.showonscreen(); // window output
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -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)));
|
||||
@ -105,7 +107,8 @@ xlabel('Doppler shift / Hz')
|
||||
ylabel('Test statistics')
|
||||
title(['Fixed code delay to ' num2str((d_max - 1) / n_fft * n_chips) ' chips'])
|
||||
subplot(2,1,2)
|
||||
plot(delay, grid(:, f_max))
|
||||
normalization = (d_samples_per_code^4) * input_power;
|
||||
plot(delay, acq_grid(:, f_max)./normalization)
|
||||
xlim([min(delay) max(delay)])
|
||||
xlabel('Code delay / chips')
|
||||
ylabel('Test statistics')
|
||||
|
18
src/utils/matlab/plot_tracking_quality_indicators.m
Normal file
18
src/utils/matlab/plot_tracking_quality_indicators.m
Normal file
@ -0,0 +1,18 @@
|
||||
%plot tracking quality indicators
|
||||
figure;
|
||||
hold on;
|
||||
title('Carrier lock test output for all the channels');
|
||||
for n=1:1:length(GNSS_tracking)
|
||||
plot(GNSS_tracking(n).carrier_lock_test)
|
||||
plotnames{n}=['SV ' num2str(round(mean(GNSS_tracking(n).PRN)))];
|
||||
end
|
||||
legend(plotnames);
|
||||
|
||||
figure;
|
||||
hold on;
|
||||
title('Carrier CN0 output for all the channels');
|
||||
for n=1:1:length(GNSS_tracking)
|
||||
plot(GNSS_tracking(n).CN0_SNV_dB_Hz)
|
||||
plotnames{n}=['SV ' num2str(round(mean(GNSS_tracking(n).PRN)))];
|
||||
end
|
||||
legend(plotnames);
|
Loading…
Reference in New Issue
Block a user