1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 20:50:33 +00:00

Replace acq configuration struct by a class

This commit is contained in:
Carles Fernandez 2018-06-19 12:59:54 +02:00
parent acd662b88f
commit 423176de7b
15 changed files with 152 additions and 51 deletions

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

@ -45,15 +45,15 @@
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"));

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,7 +93,7 @@ private:
void send_positive_acquisition(); void send_positive_acquisition();
pcpsconf_t acq_parameters; Acq_Conf acq_parameters;
bool d_active; bool d_active;
bool d_worker_active; bool d_worker_active;
bool d_cshort; bool d_cshort;

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;
unsigned int doppler_max = 0;
unsigned int num_doppler_bins_step2 = 0;
float doppler_step2 = 0.0;
long fs_in = 0;
int samples_per_ms = 0;
int samples_per_code = 0;
bool bit_transition_flag = false;
bool use_CFAR_algorithm_flag = false;
bool dump = false;
bool blocking = false;
bool make_2_steps = false;
std::string 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