1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2018-06-21 20:55:06 +02:00
commit 208c83dd41
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
39 changed files with 1181 additions and 392 deletions

View File

@ -6,20 +6,20 @@
This program is a software-defined receiver which is able to process (that is, to perform detection, synchronization, demodulation and decoding of the navigation message, computation of observables and, finally, computation of position fixes) the following Global Navigation Satellite System's signals: This program is a software-defined receiver which is able to process (that is, to perform detection, synchronization, demodulation and decoding of the navigation message, computation of observables and, finally, computation of position fixes) the following Global Navigation Satellite System's signals:
In the L1 band (centered at 1575.42 MHz): In the L1 band:
- 🛰 GPS L1 C/A :white_check_mark: - 🛰 GPS L1 C/A (centered at 1575.42 MHz) :white_check_mark:
- 🛰 Galileo E1b/c :white_check_mark: - 🛰 Galileo E1b/c (centered at 1575.42 MHz) :white_check_mark:
- 🛰 GLONASS L1 C/A :white_check_mark: - 🛰 GLONASS L1 C/A (centered at 1601.72 MHz) :white_check_mark:
In the L2 band (centered at 1227.60 MHz): In the L2 band:
- 🛰 GPS L2C :white_check_mark: - 🛰 GPS L2C (centered at 1227.60 MHz) :white_check_mark:
- 🛰 GLONASS L2 C/A :white_check_mark: - 🛰 GLONASS L2 C/A (centered at 1246 MHz) :white_check_mark:
In the L5 band (centered at 1176.45 MHz): In the L5 band:
- 🛰 GPS L5 :white_check_mark: - 🛰 GPS L5 (centered at 1176.45 MHz) :white_check_mark:
- 🛰 Galileo E5a :white_check_mark: - 🛰 Galileo E5a (centered at 1176.45 MHz) :white_check_mark:
GNSS-SDR provides interfaces for a wide range of radio frequency front-ends, generates processing outputs in standard formats, allows for the full inspection of the whole signal processing chain, and offers a framework for the development of new features. Please visit [https://gnss-sdr.org](https://gnss-sdr.org "GNSS-SDR website") for more information about this open source software-defined GNSS receiver. GNSS-SDR provides interfaces for a wide range of radio frequency front-ends and raw sample file formats, generates processing outputs in standard formats, allows for the full inspection of the whole signal processing chain, and offers a framework for the development of new features. Please visit [https://gnss-sdr.org](https://gnss-sdr.org "GNSS-SDR website") for more information about this open source software-defined GNSS receiver.

View File

@ -18,7 +18,4 @@
add_subdirectory(adapters) add_subdirectory(adapters)
add_subdirectory(gnuradio_blocks) add_subdirectory(gnuradio_blocks)
if(ENABLE_FPGA) add_subdirectory(libs)
add_subdirectory(libs)
endif(ENABLE_FPGA)

View File

@ -65,4 +65,4 @@ file(GLOB ACQ_ADAPTER_HEADERS "*.h")
list(SORT ACQ_ADAPTER_HEADERS) list(SORT ACQ_ADAPTER_HEADERS)
add_library(acq_adapters ${ACQ_ADAPTER_SOURCES} ${ACQ_ADAPTER_HEADERS}) add_library(acq_adapters ${ACQ_ADAPTER_SOURCES} ${ACQ_ADAPTER_HEADERS})
source_group(Headers FILES ${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})

View File

@ -34,6 +34,7 @@
#include "galileo_e1_signal_processing.h" #include "galileo_e1_signal_processing.h"
#include "Galileo_E1.h" #include "Galileo_E1.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -45,7 +46,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; configuration_ = configuration;
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat"; std::string default_dump_filename = "./data/acquisition.dat";

View File

@ -33,6 +33,7 @@
#include "galileo_e5_signal_processing.h" #include "galileo_e5_signal_processing.h"
#include "Galileo_E5a.h" #include "Galileo_E5a.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -44,7 +45,7 @@ using google::LogMessage;
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration, 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) 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; configuration_ = configuration;
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_filename = "../data/acquisition.dat"; std::string default_dump_filename = "../data/acquisition.dat";

View File

@ -35,6 +35,7 @@
#include "configuration_interface.h" #include "configuration_interface.h"
#include "glonass_l1_signal_processing.h" #include "glonass_l1_signal_processing.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include "GLONASS_L1_L2_CA.h" #include "GLONASS_L1_L2_CA.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -46,7 +47,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; configuration_ = configuration;
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat"; std::string default_dump_filename = "./data/acquisition.dat";

View File

@ -35,6 +35,7 @@
#include "glonass_l2_signal_processing.h" #include "glonass_l2_signal_processing.h"
#include "GLONASS_L1_L2_CA.h" #include "GLONASS_L1_L2_CA.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -45,7 +46,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; configuration_ = configuration;
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat"; std::string default_dump_filename = "./data/acquisition.dat";

View File

@ -38,6 +38,7 @@
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -48,7 +49,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; configuration_ = configuration;
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat"; std::string default_dump_filename = "./data/acquisition.dat";

View File

@ -36,6 +36,7 @@
#include "gps_l2c_signal.h" #include "gps_l2c_signal.h"
#include "GPS_L2C.h" #include "GPS_L2C.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -46,7 +47,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; configuration_ = configuration;
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat"; std::string default_dump_filename = "./data/acquisition.dat";

View File

@ -36,6 +36,7 @@
#include "gps_l5_signal.h" #include "gps_l5_signal.h"
#include "GPS_L5.h" #include "GPS_L5.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "acq_conf.h"
#include <boost/math/distributions/exponential.hpp> #include <boost/math/distributions/exponential.hpp>
#include <glog/logging.h> #include <glog/logging.h>
@ -46,7 +47,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; configuration_ = configuration;
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_filename = "./data/acquisition.dat"; std::string default_dump_filename = "./data/acquisition.dat";

View File

@ -26,12 +26,12 @@ set(ACQ_GR_BLOCKS_SOURCES
pcps_quicksync_acquisition_cc.cc pcps_quicksync_acquisition_cc.cc
galileo_pcps_8ms_acquisition_cc.cc galileo_pcps_8ms_acquisition_cc.cc
galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc
) )
if(ENABLE_FPGA) if(ENABLE_FPGA)
set(ACQ_GR_BLOCKS_SOURCES ${ACQ_GR_BLOCKS_SOURCES} pcps_acquisition_fpga.cc) set(ACQ_GR_BLOCKS_SOURCES ${ACQ_GR_BLOCKS_SOURCES} pcps_acquisition_fpga.cc)
endif(ENABLE_FPGA) endif(ENABLE_FPGA)
if(OPENCL_FOUND) if(OPENCL_FOUND)
set(ACQ_GR_BLOCKS_SOURCES ${ACQ_GR_BLOCKS_SOURCES} pcps_opencl_acquisition_cc.cc) set(ACQ_GR_BLOCKS_SOURCES ${ACQ_GR_BLOCKS_SOURCES} pcps_opencl_acquisition_cc.cc)
endif(OPENCL_FOUND) endif(OPENCL_FOUND)
@ -64,7 +64,7 @@ endif(OPENCL_FOUND)
file(GLOB ACQ_GR_BLOCKS_HEADERS "*.h") file(GLOB ACQ_GR_BLOCKS_HEADERS "*.h")
list(SORT ACQ_GR_BLOCKS_HEADERS) list(SORT ACQ_GR_BLOCKS_HEADERS)
add_library(acq_gr_blocks ${ACQ_GR_BLOCKS_SOURCES} ${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) 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}) 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})

View File

@ -45,21 +45,22 @@
using google::LogMessage; 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_)); return pcps_acquisition_sptr(new pcps_acquisition(conf_));
} }
pcps_acquisition::pcps_acquisition(pcpsconf_t conf_) : gr::block("pcps_acquisition", 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(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))) 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")); this->message_port_register_out(pmt::mp("events"));
acq_parameters = conf_; acq_parameters = conf_;
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0; // SAMPLE COUNTER
d_active = false; d_active = false;
d_positive_acq = 0;
d_state = 0; d_state = 0;
d_old_freq = 0; d_old_freq = 0;
d_well_count = 0; d_well_count = 0;
@ -121,6 +122,7 @@ pcps_acquisition::pcps_acquisition(pcpsconf_t conf_) : gr::block("pcps_acquisiti
} }
grid_ = arma::fmat(); grid_ = arma::fmat();
d_step_two = false; d_step_two = false;
d_dump_number = 0;
} }
@ -335,6 +337,81 @@ void pcps_acquisition::send_negative_acquisition()
} }
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("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);
Mat_Close(matfp);
}
}
void pcps_acquisition::acquisition_core(unsigned long int samp_count) void pcps_acquisition::acquisition_core(unsigned long int samp_count)
{ {
gr::thread::scoped_lock lk(d_setlock); gr::thread::scoped_lock lk(d_setlock);
@ -342,7 +419,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
// initialize acquisition algorithm // initialize acquisition algorithm
uint32_t indext = 0; uint32_t indext = 0;
float magt = 0.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); int effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
if (d_cshort) if (d_cshort)
{ {
@ -436,43 +513,6 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
if (acq_parameters.dump) if (acq_parameters.dump)
{ {
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size); 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 +578,11 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
d_test_statistics = d_mag / d_input_power; d_test_statistics = d_mag / d_input_power;
} }
} }
// Record results to file if required
if (acq_parameters.dump)
{
memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size);
}
} }
} }
lk.lock(); lk.lock();
@ -553,6 +598,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
send_positive_acquisition(); send_positive_acquisition();
d_step_two = false; d_step_two = false;
d_state = 0; // Positive acquisition d_state = 0; // Positive acquisition
d_positive_acq = 1;
} }
else else
{ {
@ -564,6 +610,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
{ {
send_positive_acquisition(); send_positive_acquisition();
d_state = 0; // Positive acquisition d_state = 0; // Positive acquisition
d_positive_acq = 1;
} }
} }
else if (d_well_count == acq_parameters.max_dwells) else if (d_well_count == acq_parameters.max_dwells)
@ -586,6 +633,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
send_positive_acquisition(); send_positive_acquisition();
d_step_two = false; d_step_two = false;
d_state = 0; // Positive acquisition d_state = 0; // Positive acquisition
d_positive_acq = 1;
} }
else else
{ {
@ -597,6 +645,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
{ {
send_positive_acquisition(); send_positive_acquisition();
d_state = 0; // Positive acquisition d_state = 0; // Positive acquisition
d_positive_acq = 1;
} }
} }
else else
@ -607,6 +656,11 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count)
} }
} }
d_worker_active = false; d_worker_active = false;
// Record results to file if required
if (acq_parameters.dump)
{
pcps_acquisition::dump_results(effective_fft_size);
}
} }

View File

@ -53,38 +53,20 @@
#define GNSS_SDR_PCPS_ACQUISITION_H_ #define GNSS_SDR_PCPS_ACQUISITION_H_
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "acq_conf.h"
#include <armadillo> #include <armadillo>
#include <gnuradio/block.h> #include <gnuradio/block.h>
#include <gnuradio/fft/fft.h> #include <gnuradio/fft/fft.h>
#include <volk/volk.h> #include <volk/volk.h>
#include <string> #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; class pcps_acquisition;
typedef boost::shared_ptr<pcps_acquisition> pcps_acquisition_sptr; typedef boost::shared_ptr<pcps_acquisition> pcps_acquisition_sptr;
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. * \brief This class implements a Parallel Code Phase Search Acquisition.
@ -96,9 +78,9 @@ class pcps_acquisition : public gr::block
{ {
private: private:
friend pcps_acquisition_sptr 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_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq);
void update_grid_doppler_wipeoffs(); void update_grid_doppler_wipeoffs();
@ -111,11 +93,14 @@ private:
void send_positive_acquisition(); void send_positive_acquisition();
pcpsconf_t acq_parameters; void dump_results(int effective_fft_size);
Acq_Conf acq_parameters;
bool d_active; bool d_active;
bool d_worker_active; bool d_worker_active;
bool d_cshort; bool d_cshort;
bool d_step_two; bool d_step_two;
int d_positive_acq;
float d_threshold; float d_threshold;
float d_mag; float d_mag;
float d_input_power; float d_input_power;
@ -139,6 +124,7 @@ private:
gr::fft::fft_complex* d_ifft; gr::fft::fft_complex* d_ifft;
Gnss_Synchro* d_gnss_synchro; Gnss_Synchro* d_gnss_synchro;
arma::fmat grid_; arma::fmat grid_;
long int d_dump_number;
public: public:
~pcps_acquisition(); ~pcps_acquisition();

View File

@ -16,12 +16,9 @@
# along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>. # along with GNSS-SDR. If not, see <https://www.gnu.org/licenses/>.
# #
if(ENABLE_FPGA)
set(ACQUISITION_LIB_SOURCES set(ACQUISITION_LIB_SOURCES fpga_acquisition.cc )
fpga_acquisition.cc include_directories(
)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/system_parameters
${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/interfaces
@ -31,10 +28,16 @@ include_directories(
${GLOG_INCLUDE_DIRS} ${GLOG_INCLUDE_DIRS}
${GFlags_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS}
${VOLK_GNSSSDR_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) 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}) add_library(acquisition_lib ${ACQUISITION_LIB_SOURCES} ${ACQUISITION_LIB_HEADERS})
source_group(Headers FILES ${ACQUISITION_LIB_HEADERS}) source_group(Headers FILES ${ACQUISITION_LIB_HEADERS})
target_link_libraries(acquisition_lib ${VOLK_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) 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) else(VOLK_GNSSSDR_FOUND)
add_dependencies(acquisition_lib glog-${glog_RELEASE} volk_gnsssdr_module) add_dependencies(acquisition_lib glog-${glog_RELEASE} volk_gnsssdr_module)
endif() endif()

View File

@ -0,0 +1,52 @@
/*!
* \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 = "";
it_size = sizeof(char);
}

View File

@ -0,0 +1,61 @@
/*!
* \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 make_2_steps;
std::string dump_filename;
size_t it_size;
Acq_Conf();
};
#endif

View File

@ -34,6 +34,7 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "dll_pll_conf.h"
#include "galileo_e1_dll_pll_veml_tracking.h" #include "galileo_e1_dll_pll_veml_tracking.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "Galileo_E1.h" #include "Galileo_E1.h"
@ -48,7 +49,7 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; DLOG(INFO) << "role " << role;
//################# CONFIGURATION PARAMETERS ######################## //################# CONFIGURATION PARAMETERS ########################
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";

View File

@ -35,7 +35,7 @@
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "dll_pll_conf.h"
#include "galileo_e5a_dll_pll_tracking.h" #include "galileo_e5a_dll_pll_tracking.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "Galileo_E5a.h" #include "Galileo_E5a.h"
@ -49,7 +49,7 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; DLOG(INFO) << "role " << role;
//################# CONFIGURATION PARAMETERS ######################## //################# CONFIGURATION PARAMETERS ########################
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";

View File

@ -35,7 +35,7 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "dll_pll_conf.h"
#include "gps_l1_ca_dll_pll_tracking.h" #include "gps_l1_ca_dll_pll_tracking.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
@ -49,7 +49,7 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; DLOG(INFO) << "role " << role;
//################# CONFIGURATION PARAMETERS ######################## //################# CONFIGURATION PARAMETERS ########################
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
@ -108,13 +108,13 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking(
int cn0_samples = configuration->property(role + ".cn0_samples", 20); int cn0_samples = configuration->property(role + ".cn0_samples", 20);
if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples; if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples;
trk_param.cn0_samples = 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; if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min;
trk_param.cn0_min = cn0_min; trk_param.cn0_min = cn0_min;
int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); int max_lock_fail = configuration->property(role + ".max_lock_fail", 50);
if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail; if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail;
trk_param.max_lock_fail = 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; if (FLAGS_carrier_lock_th != 0.85) carrier_lock_th = FLAGS_carrier_lock_th;
trk_param.carrier_lock_th = carrier_lock_th; trk_param.carrier_lock_th = carrier_lock_th;

View File

@ -34,7 +34,7 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "dll_pll_conf.h"
#include "gps_l2_m_dll_pll_tracking.h" #include "gps_l2_m_dll_pll_tracking.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "GPS_L2C.h" #include "GPS_L2C.h"
@ -49,7 +49,7 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; DLOG(INFO) << "role " << role;
//################# CONFIGURATION PARAMETERS ######################## //################# CONFIGURATION PARAMETERS ########################
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";

View File

@ -34,7 +34,7 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "dll_pll_conf.h"
#include "gps_l5_dll_pll_tracking.h" #include "gps_l5_dll_pll_tracking.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "GPS_L5.h" #include "GPS_L5.h"
@ -49,7 +49,7 @@ GpsL5DllPllTracking::GpsL5DllPllTracking(
ConfigurationInterface* configuration, std::string role, ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) 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; DLOG(INFO) << "role " << role;
//################# CONFIGURATION PARAMETERS ######################## //################# CONFIGURATION PARAMETERS ########################
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";

View File

@ -60,7 +60,7 @@
using google::LogMessage; 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_)); 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)), 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))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
{ {
trk_parameters = conf_; trk_parameters = conf_;
// Telemetry bit synchronization message port input // Telemetry bit synchronization message port input

View File

@ -31,6 +31,7 @@
#ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_H #ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_H
#define 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 "gnss_synchro.h"
#include "tracking_2nd_DLL_filter.h" #include "tracking_2nd_DLL_filter.h"
#include "tracking_2nd_PLL_filter.h" #include "tracking_2nd_PLL_filter.h"
@ -39,37 +40,13 @@
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <map> #include <map>
#include <queue>
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;
class dll_pll_veml_tracking; class dll_pll_veml_tracking;
typedef boost::shared_ptr<dll_pll_veml_tracking> dll_pll_veml_tracking_sptr; 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. * \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); void forecast(int noutput_items, gr_vector_int &ninput_items_required);
private: 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 cn0_and_tracking_lock_status(double coh_integration_time_s);
bool acquire_secondary(); bool acquire_secondary();
@ -104,7 +81,7 @@ private:
int save_matfile(); int save_matfile();
// tracking configuration vars // tracking configuration vars
dllpllconf_t trk_parameters; Dll_Pll_Conf trk_parameters;
bool d_veml; bool d_veml;
bool d_cloop; bool d_cloop;
unsigned int d_channel; unsigned int d_channel;
@ -201,6 +178,7 @@ private:
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int d_cn0_estimation_counter;
int d_carrier_lock_fail_counter; int d_carrier_lock_fail_counter;
std::deque<float> d_carrier_lock_detector_queue;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;

View File

@ -43,6 +43,7 @@ set(TRACKING_LIB_SOURCES
tracking_discriminators.cc tracking_discriminators.cc
tracking_FLL_PLL_filter.cc tracking_FLL_PLL_filter.cc
tracking_loop_filter.cc tracking_loop_filter.cc
dll_pll_conf.cc
) )
if(ENABLE_FPGA) if(ENABLE_FPGA)

View 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);
}

View 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

View File

@ -1304,6 +1304,7 @@ void GNSSFlowgraph::set_channels_state()
} }
DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i];
} }
std::lock_guard<std::mutex> lock(signal_list_mutex);
acq_channels_count_ = max_acq_channels_; acq_channels_count_ = max_acq_channels_;
DLOG(INFO) << acq_channels_count_ << " channels in acquisition state"; DLOG(INFO) << acq_channels_count_ << " channels in acquisition state";
} }

View File

@ -107,17 +107,17 @@ public:
void set_configuration(std::shared_ptr<ConfigurationInterface> configuration); void set_configuration(std::shared_ptr<ConfigurationInterface> configuration);
unsigned int applied_actions() unsigned int applied_actions() const
{ {
return applied_actions_; return applied_actions_;
} }
bool connected() bool connected() const
{ {
return connected_; return connected_;
} }
bool running() bool running() const
{ {
return running_; return running_;
} }

View File

@ -69,7 +69,7 @@
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
//all UNIX-like OSs (Linux, *BSD, MacOSX, Solaris, ...) //all UNIX-like OSs (Linux, *BSD, MacOSX, Solaris, ...)
#include <unistd.h> // for access(), mkstemp() #include <unistd.h> // for access(), mkstemp()
#define GP_MAX_TMP_FILES 64 #define GP_MAX_TMP_FILES 1024
#else #else
#error unsupported or unknown operating system #error unsupported or unknown operating system
#endif #endif
@ -302,9 +302,9 @@ public:
/// ///
/// \return <-- reference to the gnuplot object /// \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; return *this;
}; };
@ -1906,11 +1906,11 @@ void Gnuplot::init()
std::string tmp = Gnuplot::m_sGNUPlotPath + "/" + std::string tmp = Gnuplot::m_sGNUPlotPath + "/" +
Gnuplot::m_sGNUPlotFileName; Gnuplot::m_sGNUPlotFileName;
// FILE *popen(const char *command, const char *mode); // FILE *popen(const char *command, const char *mode);
// The popen() function shall execute the command specified by the string // The popen() function shall execute the command specified by the string
// command, create a pipe between the calling program and the executed // 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 // command, and return a pointer to a stream that can be used to either read
// from or write to the pipe. // from or write to the pipe.
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
gnucmd = _popen(tmp.c_str(), "w"); gnucmd = _popen(tmp.c_str(), "w");
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
@ -1974,7 +1974,7 @@ bool Gnuplot::get_program_path()
std::list<std::string> ls; 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__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
stringtok(ls, path_str, ";"); stringtok(ls, path_str, ";");
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
@ -2018,16 +2018,16 @@ bool Gnuplot::file_exists(const std::string &filename, int mode)
return false; return false;
} }
// int _access(const char *path, int mode); // int _access(const char *path, int mode);
// returns 0 if the file has the given 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 // it returns -1 if the named file does not exist or is not accessible in
// the given mode // the given mode
// mode = 0 (F_OK) (default): checks file for existence only // mode = 0 (F_OK) (default): checks file for existence only
// mode = 1 (X_OK): execution permission // mode = 1 (X_OK): execution permission
// mode = 2 (W_OK): write permission // mode = 2 (W_OK): write permission
// mode = 4 (R_OK): read permission // mode = 4 (R_OK): read permission
// mode = 6 : read and write permission // mode = 6 : read and write permission
// mode = 7 : read, write and execution permission // mode = 7 : read, write and execution permission
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
if (_access(filename.c_str(), mode) == 0) if (_access(filename.c_str(), mode) == 0)
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
@ -2089,19 +2089,19 @@ std::string Gnuplot::create_tmpfile(std::ofstream &tmp)
throw GnuplotException(except.str()); throw GnuplotException(except.str());
} }
// int mkstemp(char *name); // int mkstemp(char *name);
// shall replace the contents of the string pointed to by "name" by a unique // shall replace the contents of the string pointed to by "name" by a unique
// filename, and return a file descriptor for the file open for reading and // filename, and return a file descriptor for the file open for reading and
// writing. Otherwise, -1 shall be returned if no suitable file could be // writing. Otherwise, -1 shall be returned if no suitable file could be
// created. The string in template should look like a filename with six // created. The string in template should look like a filename with six
// trailing 'X' s; mkstemp() replaces each 'X' with a character from the // trailing 'X' s; mkstemp() replaces each 'X' with a character from the
// portable filename character set. The characters are chosen such that the // portable filename character set. The characters are chosen such that the
// resulting name does not duplicate the name of an existing file at the // resulting name does not duplicate the name of an existing file at the
// time of a call to mkstemp() // time of a call to mkstemp()
// //
// open temporary files for output // open temporary files for output
// //
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
if (_mktemp(name) == NULL) if (_mktemp(name) == NULL)

View File

@ -175,7 +175,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid()
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN); unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !! unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !!
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code); 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; if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;

View File

@ -73,16 +73,51 @@ bool acquisition_dump_reader::read_binary_acq()
Mat_Close(matfile); Mat_Close(matfile);
return false; 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_);
std::vector<std::vector<float> >::iterator it1; std::vector<std::vector<float> >::iterator it1;
std::vector<float>::iterator it2; std::vector<float>::iterator it2;
float* aux = static_cast<float*>(var_->data); float* aux = static_cast<float*>(var_->data);
int k = 0; int k = 0;
float normalization_factor = std::pow(d_samples_per_code, 2);
for (it1 = mag.begin(); it1 != mag.end(); it1++) for (it1 = mag.begin(); it1 != mag.end(); it1++)
{ {
for (it2 = it1->begin(); it2 != it1->end(); it2++) for (it2 = it1->begin(); it2 != it1->end(); it2++)
{ {
*it2 = static_cast<float>(std::sqrt(aux[k])) / normalization_factor; *it2 = static_cast<float>(aux[k]) / input_power;
k++; k++;
} }
} }
@ -93,17 +128,30 @@ bool acquisition_dump_reader::read_binary_acq()
} }
acquisition_dump_reader::acquisition_dump_reader(const std::string& basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code) acquisition_dump_reader::acquisition_dump_reader(const std::string& basename,
unsigned int sat,
unsigned int doppler_max,
unsigned int doppler_step,
unsigned int samples_per_code,
int channel,
int execution)
{ {
d_basename = basename; d_basename = basename;
d_sat = sat; d_sat = sat;
d_doppler_max = doppler_max; d_doppler_max = doppler_max;
d_doppler_step = doppler_step; d_doppler_step = doppler_step;
d_samples_per_code = samples_per_code; 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;
d_num_doppler_bins = static_cast<unsigned int>(ceil(static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step))); d_num_doppler_bins = static_cast<unsigned int>(ceil(static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step)));
std::vector<std::vector<float> > mag_aux(d_num_doppler_bins, std::vector<float>(d_samples_per_code)); std::vector<std::vector<float> > mag_aux(d_num_doppler_bins, std::vector<float>(d_samples_per_code));
mag = mag_aux; 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++) 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); doppler.push_back(-static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index);

View File

@ -38,13 +38,26 @@
class acquisition_dump_reader class acquisition_dump_reader
{ {
public: 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(); ~acquisition_dump_reader();
bool read_binary_acq(); bool read_binary_acq();
std::vector<int> doppler; std::vector<int> doppler;
std::vector<unsigned int> samples; std::vector<unsigned int> samples;
std::vector<std::vector<float> > mag; 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;
long unsigned int sample_counter;
private: private:
std::string d_basename; std::string d_basename;

View File

@ -112,6 +112,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_) observables_dump_reader::observables_dump_reader(int n_channels_)
{ {

View File

@ -44,6 +44,7 @@ public:
bool restart(); bool restart();
long int num_epochs(); long int num_epochs();
bool open_obs_file(std::string out_file); bool open_obs_file(std::string out_file);
void close_obs_file();
//dump variables //dump variables

View File

@ -89,15 +89,16 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file)
{ {
try try
{ {
d_dump_file.clear();
d_dump_filename = out_file; d_dump_filename = out_file;
d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); 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; std::cout << "Tracking Log file: " << d_dump_filename.c_str() << " open ok " << std::endl;
return true; return true;
} }
catch (const std::ifstream::failure &e) catch (const std::ifstream::failure &e)
{ {
std::cout << "Problem opening Observables dump Log file: " << d_dump_filename.c_str() << std::endl; std::cout << "Problem opening Tracking dump Log file: " << d_dump_filename.c_str() << " Error: " << e.what() << std::endl;
return false; return false;
} }
} }
@ -107,6 +108,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() tracking_true_obs_reader::~tracking_true_obs_reader()
{ {

View File

@ -43,6 +43,7 @@ public:
bool restart(); bool restart();
long int num_epochs(); long int num_epochs();
bool open_obs_file(std::string out_file); bool open_obs_file(std::string out_file);
void close_obs_file();
bool d_dump; bool d_dump;
double signal_timestamp_s; double signal_timestamp_s;

View File

@ -33,6 +33,8 @@ file = 'acq';
sat = 7; sat = 7;
channel = 0;
execution = 1;
% Signal: % Signal:
% 1 GPS L1 % 1 GPS L1
% 2 GPS L2M % 2 GPS L2M
@ -77,7 +79,7 @@ switch(signal_type)
system = 'R'; system = 'R';
signal = '1G'; signal = '1G';
end 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); load(filename);
[n_fft n_dop_bins] = size(grid); [n_fft n_dop_bins] = size(grid);
[d_max f_max] = find(grid == max(max(grid))); [d_max f_max] = find(grid == max(max(grid)));

View 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);