1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-16 13:10:35 +00:00

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

This commit is contained in:
Carles Fernandez 2018-05-01 23:38:34 +02:00
commit aef72772e9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
9 changed files with 462 additions and 355 deletions

View File

@ -29,7 +29,7 @@ if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio") message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio")
message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio") message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio")
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio") message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled") message(FATAL_ERROR "gnuradio-iio is required for building gnss-sdr with this option enabled.")
endif(NOT IIO_FOUND) endif(NOT IIO_FOUND)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES}) set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS}) set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
@ -38,12 +38,12 @@ endif(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
if(ENABLE_AD9361) if(ENABLE_AD9361)
find_package(libiio REQUIRED) find_package(libiio REQUIRED)
if(NOT LIBIIO_FOUND) if(NOT LIBIIO_FOUND)
message(STATUS "gnuradio-iio not found, its installation is required.") message(STATUS "libiio not found, its installation is required.")
message(STATUS "Please build and install the following projects:") message(STATUS "Please build and install the following projects:")
message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio") message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio")
message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio") message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio")
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio") message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled") message(FATAL_ERROR "libiio is required for building gnss-sdr with this option enabled.")
endif(NOT LIBIIO_FOUND) endif(NOT LIBIIO_FOUND)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBIIO_LIBRARIES}) set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBIIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${LIBIIO_INCLUDE_DIRS}) set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${LIBIIO_INCLUDE_DIRS})

View File

@ -35,10 +35,8 @@
#include "ad9361_manager.h" #include "ad9361_manager.h"
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "GPS_L2C.h" #include "GPS_L2C.h"
#include <signal.h>
#include <stdio.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <iostream> #include <iostream> // for cout, endl
#ifdef __APPLE__ #ifdef __APPLE__
#include <iio/iio.h> #include <iio/iio.h>
@ -48,9 +46,7 @@
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration, Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream, std::string role, unsigned int in_stream, unsigned int out_stream,
boost::shared_ptr<gr::msg_queue> queue) : boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
role_(role), in_stream_(in_stream), out_stream_(out_stream),
queue_(queue)
{ {
std::string default_item_type = "gr_complex"; std::string default_item_type = "gr_complex";
std::string default_dump_file = "./data/signal_source.dat"; std::string default_dump_file = "./data/signal_source.dat";
@ -75,12 +71,12 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configura
dump_ = configuration->property(role + ".dump", false); dump_ = configuration->property(role + ".dump", false);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
enable_dds_lo_=configuration->property(role + ".enable_dds_lo", false); enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false);
freq_rf_tx_hz_=configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ-GPS_L2_FREQ_HZ-1000); freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - 1000);
freq_dds_tx_hz_=configuration->property(role + ".freq_dds_tx_hz", 1000); freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", 1000);
scale_dds_dbfs_=configuration->property(role + ".scale_dds_dbfs", -3.0); scale_dds_dbfs_ = configuration->property(role + ".scale_dds_dbfs", -3.0);
phase_dds_deg_=configuration->property(role + ".phase_dds_deg", 0.0); phase_dds_deg_ = configuration->property(role + ".phase_dds_deg", 0.0);
tx_attenuation_db_=configuration->property(role + ".tx_attenuation_db", 0.0); tx_attenuation_db_ = configuration->property(role + ".tx_attenuation_db", 0.0);
item_size_ = sizeof(gr_complex); item_size_ = sizeof(gr_complex);
@ -98,7 +94,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configura
rf_gain_rx2_); rf_gain_rx2_);
//LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION //LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION
if (enable_dds_lo_==true) if (enable_dds_lo_ == true)
{ {
config_ad9361_lo_local(bandwidth_, config_ad9361_lo_local(bandwidth_,
sample_rate_, sample_rate_,
@ -112,7 +108,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configura
std::string default_device_name = "/dev/uio13"; std::string default_device_name = "/dev/uio13";
std::string device_name = configuration->property(role + ".devicename", default_device_name); std::string device_name = configuration->property(role + ".devicename", default_device_name);
int switch_position = configuration->property(role + ".switch_position", 0); int switch_position = configuration->property(role + ".switch_position", 0);
switch_fpga = std::make_shared <fpga_switch>(device_name); switch_fpga = std::make_shared<fpga_switch>(device_name);
switch_fpga->set_switch_position(switch_position); switch_fpga->set_switch_position(switch_position);
} }

View File

@ -34,21 +34,20 @@
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include "fpga_switch.h" #include "fpga_switch.h"
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <gnuradio/msg_queue.h> #include <gnuradio/msg_queue.h>
#include <string> #include <string>
class ConfigurationInterface; class ConfigurationInterface;
class Ad9361FpgaSignalSource: public GNSSBlockInterface class Ad9361FpgaSignalSource : public GNSSBlockInterface
{ {
public: public:
Ad9361FpgaSignalSource(ConfigurationInterface* configuration, Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, std::string role, unsigned int in_stream,
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue); unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
virtual ~Ad9361FpgaSignalSource(); ~Ad9361FpgaSignalSource();
inline std::string role() override inline std::string role() override
{ {
@ -77,11 +76,11 @@ private:
std::string role_; std::string role_;
// Front-end settings // Front-end settings
std::string uri_;//device direction std::string uri_; // device direction
unsigned long freq_; //frequency of local oscilator unsigned long freq_; // frequency of local oscillator
unsigned long sample_rate_; unsigned long sample_rate_;
unsigned long bandwidth_; unsigned long bandwidth_;
unsigned long buffer_size_; //reception buffer unsigned long buffer_size_; // reception buffer
bool rx1_en_; bool rx1_en_;
bool rx2_en_; bool rx2_en_;
bool quadrature_; bool quadrature_;
@ -95,7 +94,7 @@ private:
std::string filter_file_; std::string filter_file_;
bool filter_auto_; bool filter_auto_;
//DDS configuration for LO generation for external mixer // DDS configuration for LO generation for external mixer
bool enable_dds_lo_; bool enable_dds_lo_;
unsigned long freq_rf_tx_hz_; unsigned long freq_rf_tx_hz_;
unsigned long freq_dds_tx_hz_; unsigned long freq_dds_tx_hz_;

View File

@ -52,10 +52,10 @@ if(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
endif(LIBIIO_FOUND) endif(LIBIIO_FOUND)
endif(ENABLE_FMCOMMS2 OR ENABLE_AD9361) endif(ENABLE_FMCOMMS2 OR ENABLE_AD9361)
if(ENABLE_FPGA) if(ENABLE_FPGA OR ENABLE_AD9361)
set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_switch.cc) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_switch.cc)
set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_switch.h) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_switch.h)
endif(ENABLE_FPGA) endif(ENABLE_FPGA OR ENABLE_AD9361)
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}

View File

@ -35,52 +35,33 @@
*/ */
#include "fpga_switch.h" #include "fpga_switch.h"
#include <cmath>
// FPGA stuff
#include <new>
// libraries used by DMA test code and GIPO test code
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
// libraries used by DMA test code
#include <sys/stat.h>
#include <stdint.h>
#include <unistd.h>
#include <assert.h>
// libraries used by GPIO test code
#include <stdlib.h>
#include <signal.h>
#include <sys/mman.h>
// logging
#include <glog/logging.h> #include <glog/logging.h>
#include <fcntl.h> // for open, O_RDWR, O_SYNC
#include <iostream> // for cout, endl
#include <sys/mman.h> // for mmap
// string manipulation
#include <string>
// constants // constants
#define PAGE_SIZE 0x10000 const size_t PAGE_SIZE = 0x10000;
#define TEST_REGISTER_TRACK_WRITEVAL 0x55AA const unsigned int TEST_REGISTER_TRACK_WRITEVAL = 0x55AA;
fpga_switch::fpga_switch(std::string device_name) fpga_switch::fpga_switch(std::string device_name)
{ {
if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
{ {
LOG(WARNING) << "Cannot open deviceio" << device_name; LOG(WARNING) << "Cannot open deviceio" << device_name;
printf("switch memory successfully mapped\n");
} }
d_map_base = reinterpret_cast<volatile unsigned *>(mmap(NULL, PAGE_SIZE, d_map_base = reinterpret_cast<volatile unsigned *>(mmap(nullptr, PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0)); PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0));
if (d_map_base == reinterpret_cast<void *>(-1)) if (d_map_base == reinterpret_cast<void *>(-1))
{ {
LOG(WARNING) << "Cannot map the FPGA switch module into tracking memory"; LOG(WARNING) << "Cannot map the FPGA switch module into tracking memory";
printf("could not map switch memory\n"); std::cout << "Could not map switch memory." << std::endl;
}
else
{
std::cout << "Switch memory successfully mapped." << std::endl;
} }
// sanity check : check test register // sanity check : check test register
@ -130,7 +111,7 @@ void fpga_switch::close_device()
unsigned *aux = const_cast<unsigned *>(d_map_base); unsigned *aux = const_cast<unsigned *>(d_map_base);
if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1) if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1)
{ {
printf("Failed to unmap memory uio\n"); std::cout << "Failed to unmap memory uio" << std::endl;
} }
close(d_device_descriptor); close(d_device_descriptor);

View File

@ -37,7 +37,7 @@
#ifndef GNSS_SDR_FPGA_SWITCH_H_ #ifndef GNSS_SDR_FPGA_SWITCH_H_
#define GNSS_SDR_FPGA_SWITCH_H_ #define GNSS_SDR_FPGA_SWITCH_H_
#include <gnuradio/block.h> #include <string>
#define MAX_LENGTH_DEVICEIO_NAME 50 #define MAX_LENGTH_DEVICEIO_NAME 50

View File

@ -110,7 +110,15 @@ ControlThread::~ControlThread()
void ControlThread::run() void ControlThread::run()
{ {
// Connect the flowgraph // Connect the flowgraph
try
{
flowgraph_->connect(); flowgraph_->connect();
}
catch (const std::exception e)
{
LOG(ERROR) << e.what();
return;
}
if (flowgraph_->connected()) if (flowgraph_->connected())
{ {
LOG(INFO) << "Flowgraph connected"; LOG(INFO) << "Flowgraph connected";
@ -271,6 +279,7 @@ bool ControlThread::read_assistance_from_XML()
return ret; return ret;
} }
void ControlThread::assist_GNSS() void ControlThread::assist_GNSS()
{ {
//######### GNSS Assistance ################################# //######### GNSS Assistance #################################

View File

@ -148,7 +148,6 @@
#include "gps_l1_ca_dll_pll_tracking_gpu.h" #include "gps_l1_ca_dll_pll_tracking_gpu.h"
#endif #endif
#include <boost/lexical_cast.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <string> #include <string>
#include <sstream> #include <sstream>
@ -169,9 +168,16 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalSource(
{ {
std::string default_implementation = "File_Signal_Source"; std::string default_implementation = "File_Signal_Source";
std::string role = "SignalSource"; //backwards compatibility for old conf files std::string role = "SignalSource"; //backwards compatibility for old conf files
try
{
if (ID != -1) if (ID != -1)
{ {
role = "SignalSource" + boost::lexical_cast<std::string>(ID); role = "SignalSource" + std::to_string(ID);
}
}
catch (const std::exception &e)
{
LOG(WARNING) << e.what();
} }
std::string implementation = configuration->property(role + ".implementation", default_implementation); std::string implementation = configuration->property(role + ".implementation", default_implementation);
LOG(INFO) << "Getting SignalSource with implementation " << implementation; LOG(INFO) << "Getting SignalSource with implementation " << implementation;
@ -188,15 +194,20 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalConditioner(
std::string role_datatypeadapter = "DataTypeAdapter"; std::string role_datatypeadapter = "DataTypeAdapter";
std::string role_inputfilter = "InputFilter"; std::string role_inputfilter = "InputFilter";
std::string role_resampler = "Resampler"; std::string role_resampler = "Resampler";
try
{
if (ID != -1) if (ID != -1)
{ {
role_conditioner = "SignalConditioner" + boost::lexical_cast<std::string>(ID); role_conditioner = "SignalConditioner" + std::to_string(ID);
role_datatypeadapter = "DataTypeAdapter" + boost::lexical_cast<std::string>(ID); role_datatypeadapter = "DataTypeAdapter" + std::to_string(ID);
role_inputfilter = "InputFilter" + boost::lexical_cast<std::string>(ID); role_inputfilter = "InputFilter" + std::to_string(ID);
role_resampler = "Resampler" + boost::lexical_cast<std::string>(ID); role_resampler = "Resampler" + std::to_string(ID);
}
}
catch (const std::exception &e)
{
LOG(WARNING) << e.what();
} }
std::string signal_conditioner = configuration->property(role_conditioner + ".implementation", default_implementation); std::string signal_conditioner = configuration->property(role_conditioner + ".implementation", default_implementation);
std::string data_type_adapter; std::string data_type_adapter;
@ -293,31 +304,31 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_1C(
LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm;
std::string aux = configuration->property("Acquisition_1C" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); std::string aux = configuration->property("Acquisition_1C" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix1; std::string appendix1;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix1 = boost::lexical_cast<std::string>(channel); appendix1 = std::to_string(channel);
} }
else else
{ {
appendix1 = ""; appendix1 = "";
} }
aux = configuration->property("Tracking_1C" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("Tracking_1C" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix2; std::string appendix2;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix2 = boost::lexical_cast<std::string>(channel); appendix2 = std::to_string(channel);
} }
else else
{ {
appendix2 = ""; appendix2 = "";
} }
aux = configuration->property("TelemetryDecoder_1C" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("TelemetryDecoder_1C" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix3; std::string appendix3;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix3 = boost::lexical_cast<std::string>(channel); appendix3 = std::to_string(channel);
} }
else else
{ {
@ -358,31 +369,31 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_2S(
{ {
LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm;
std::string aux = configuration->property("Acquisition_2S" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); std::string aux = configuration->property("Acquisition_2S" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix1; std::string appendix1;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix1 = boost::lexical_cast<std::string>(channel); appendix1 = std::to_string(channel);
} }
else else
{ {
appendix1 = ""; appendix1 = "";
} }
aux = configuration->property("Tracking_2S" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("Tracking_2S" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix2; std::string appendix2;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix2 = boost::lexical_cast<std::string>(channel); appendix2 = std::to_string(channel);
} }
else else
{ {
appendix2 = ""; appendix2 = "";
} }
aux = configuration->property("TelemetryDecoder_2S" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("TelemetryDecoder_2S" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix3; std::string appendix3;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix3 = boost::lexical_cast<std::string>(channel); appendix3 = std::to_string(channel);
} }
else else
{ {
@ -426,31 +437,31 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_1B(
std::string id = stream.str(); std::string id = stream.str();
LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: " LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm;
std::string aux = configuration->property("Acquisition_1B" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); std::string aux = configuration->property("Acquisition_1B" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix1; std::string appendix1;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix1 = boost::lexical_cast<std::string>(channel); appendix1 = std::to_string(channel);
} }
else else
{ {
appendix1 = ""; appendix1 = "";
} }
aux = configuration->property("Tracking_1B" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("Tracking_1B" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix2; std::string appendix2;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix2 = boost::lexical_cast<std::string>(channel); appendix2 = std::to_string(channel);
} }
else else
{ {
appendix2 = ""; appendix2 = "";
} }
aux = configuration->property("TelemetryDecoder_1B" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("TelemetryDecoder_1B" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix3; std::string appendix3;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix3 = boost::lexical_cast<std::string>(channel); appendix3 = std::to_string(channel);
} }
else else
{ {
@ -494,31 +505,31 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_5X(
std::string id = stream.str(); std::string id = stream.str();
LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: " LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm;
std::string aux = configuration->property("Acquisition_5X" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); std::string aux = configuration->property("Acquisition_5X" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix1; std::string appendix1;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix1 = boost::lexical_cast<std::string>(channel); appendix1 = std::to_string(channel);
} }
else else
{ {
appendix1 = ""; appendix1 = "";
} }
aux = configuration->property("Tracking_5X" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("Tracking_5X" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix2; std::string appendix2;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix2 = boost::lexical_cast<std::string>(channel); appendix2 = std::to_string(channel);
} }
else else
{ {
appendix2 = ""; appendix2 = "";
} }
aux = configuration->property("TelemetryDecoder_5X" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("TelemetryDecoder_5X" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix3; std::string appendix3;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix3 = boost::lexical_cast<std::string>(channel); appendix3 = std::to_string(channel);
} }
else else
{ {
@ -563,31 +574,31 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_1G(
LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder Implementation: " << tlm; << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder Implementation: " << tlm;
std::string aux = configuration->property("Acquisition_1G" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); std::string aux = configuration->property("Acquisition_1G" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix1; std::string appendix1;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix1 = boost::lexical_cast<std::string>(channel); appendix1 = std::to_string(channel);
} }
else else
{ {
appendix1 = ""; appendix1 = "";
} }
aux = configuration->property("Tracking_1G" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("Tracking_1G" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix2; std::string appendix2;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix2 = boost::lexical_cast<std::string>(channel); appendix2 = std::to_string(channel);
} }
else else
{ {
appendix2 = ""; appendix2 = "";
} }
aux = configuration->property("TelemetryDecoder_1G" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("TelemetryDecoder_1G" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix3; std::string appendix3;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix3 = boost::lexical_cast<std::string>(channel); appendix3 = std::to_string(channel);
} }
else else
{ {
@ -632,31 +643,31 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_2G(
LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder Implementation: " << tlm; << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder Implementation: " << tlm;
std::string aux = configuration->property("Acquisition_2G" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); std::string aux = configuration->property("Acquisition_2G" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix1; std::string appendix1;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix1 = boost::lexical_cast<std::string>(channel); appendix1 = std::to_string(channel);
} }
else else
{ {
appendix1 = ""; appendix1 = "";
} }
aux = configuration->property("Tracking_2G" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("Tracking_2G" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix2; std::string appendix2;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix2 = boost::lexical_cast<std::string>(channel); appendix2 = std::to_string(channel);
} }
else else
{ {
appendix2 = ""; appendix2 = "";
} }
aux = configuration->property("TelemetryDecoder_2G" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("TelemetryDecoder_2G" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix3; std::string appendix3;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix3 = boost::lexical_cast<std::string>(channel); appendix3 = std::to_string(channel);
} }
else else
{ {
@ -700,31 +711,31 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetChannel_L5(
std::string id = stream.str(); std::string id = stream.str();
LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: " LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: "
<< acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm;
std::string aux = configuration->property("Acquisition_L5" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); std::string aux = configuration->property("Acquisition_L5" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix1; std::string appendix1;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix1 = boost::lexical_cast<std::string>(channel); appendix1 = std::to_string(channel);
} }
else else
{ {
appendix1 = ""; appendix1 = "";
} }
aux = configuration->property("Tracking_L5" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("Tracking_L5" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix2; std::string appendix2;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix2 = boost::lexical_cast<std::string>(channel); appendix2 = std::to_string(channel);
} }
else else
{ {
appendix2 = ""; appendix2 = "";
} }
aux = configuration->property("TelemetryDecoder_L5" + boost::lexical_cast<std::string>(channel) + ".implementation", std::string("W")); aux = configuration->property("TelemetryDecoder_L5" + std::to_string(channel) + ".implementation", std::string("W"));
std::string appendix3; std::string appendix3;
if (aux.compare("W") != 0) if (aux.compare("W") != 0)
{ {
appendix3 = boost::lexical_cast<std::string>(channel); appendix3 = std::to_string(channel);
} }
else else
{ {
@ -768,23 +779,24 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
unsigned int channel_absolute_id = 0; unsigned int channel_absolute_id = 0;
unsigned int Channels_1C_count = configuration->property("Channels_1C.count", 0); unsigned int Channels_1C_count = configuration->property("Channels_1C.count", 0);
unsigned int Channels_2S_count = configuration->property("Channels_2S.count", 0);
unsigned int Channels_1B_count = configuration->property("Channels_1B.count", 0); unsigned int Channels_1B_count = configuration->property("Channels_1B.count", 0);
unsigned int Channels_5X_count = configuration->property("Channels_5X.count", 0);
unsigned int Channels_1G_count = configuration->property("Channels_1G.count", 0); unsigned int Channels_1G_count = configuration->property("Channels_1G.count", 0);
unsigned int Channels_2G_count = configuration->property("Channels_2G.count", 0); unsigned int Channels_2G_count = configuration->property("Channels_2G.count", 0);
unsigned int Channels_2S_count = configuration->property("Channels_2S.count", 0);
unsigned int Channels_5X_count = configuration->property("Channels_5X.count", 0);
unsigned int Channels_L5_count = configuration->property("Channels_L5.count", 0); unsigned int Channels_L5_count = configuration->property("Channels_L5.count", 0);
unsigned int total_channels = Channels_1C_count + unsigned int total_channels = Channels_1C_count +
Channels_2S_count +
Channels_1B_count + Channels_1B_count +
Channels_5X_count +
Channels_1G_count + Channels_1G_count +
Channels_2S_count +
Channels_2G_count + Channels_2G_count +
Channels_5X_count +
Channels_L5_count; Channels_L5_count;
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels(new std::vector<std::unique_ptr<GNSSBlockInterface>>(total_channels)); std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels(new std::vector<std::unique_ptr<GNSSBlockInterface>>(total_channels));
try
{
//**************** GPS L1 C/A CHANNELS ********************** //**************** GPS L1 C/A CHANNELS **********************
LOG(INFO) << "Getting " << Channels_1C_count << " GPS L1 C/A channels"; LOG(INFO) << "Getting " << Channels_1C_count << " GPS L1 C/A channels";
acquisition_implementation = configuration->property("Acquisition_1C.implementation", default_implementation); acquisition_implementation = configuration->property("Acquisition_1C.implementation", default_implementation);
@ -795,14 +807,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{ {
//(i.e. Acquisition_1C0.implementation=xxxx) //(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property( std::string acquisition_implementation_specific = configuration->property(
"Acquisition_1C" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Acquisition_1C" + std::to_string(channel_absolute_id) + ".implementation",
acquisition_implementation); acquisition_implementation);
//(i.e. Tracking_1C0.implementation=xxxx) //(i.e. Tracking_1C0.implementation=xxxx)
std::string tracking_implementation_specific = configuration->property( std::string tracking_implementation_specific = configuration->property(
"Tracking_1C" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Tracking_1C" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation); tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property( std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_1C" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "TelemetryDecoder_1C" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation); telemetry_decoder_implementation);
// Push back the channel to the vector of channels // Push back the channel to the vector of channels
@ -824,14 +836,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{ {
//(i.e. Acquisition_1C0.implementation=xxxx) //(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property( std::string acquisition_implementation_specific = configuration->property(
"Acquisition_2S" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Acquisition_2S" + std::to_string(channel_absolute_id) + ".implementation",
acquisition_implementation); acquisition_implementation);
//(i.e. Tracking_1C0.implementation=xxxx) //(i.e. Tracking_1C0.implementation=xxxx)
std::string tracking_implementation_specific = configuration->property( std::string tracking_implementation_specific = configuration->property(
"Tracking_2S" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Tracking_2S" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation); tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property( std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_2S" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "TelemetryDecoder_2S" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation); telemetry_decoder_implementation);
// Push back the channel to the vector of channels // Push back the channel to the vector of channels
@ -853,14 +865,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{ {
//(i.e. Acquisition_1C0.implementation=xxxx) //(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property( std::string acquisition_implementation_specific = configuration->property(
"Acquisition_L5" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Acquisition_L5" + std::to_string(channel_absolute_id) + ".implementation",
acquisition_implementation); acquisition_implementation);
//(i.e. Tracking_1C0.implementation=xxxx) //(i.e. Tracking_1C0.implementation=xxxx)
std::string tracking_implementation_specific = configuration->property( std::string tracking_implementation_specific = configuration->property(
"Tracking_L5" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Tracking_L5" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation); tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property( std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_L5" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "TelemetryDecoder_L5" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation); telemetry_decoder_implementation);
// Push back the channel to the vector of channels // Push back the channel to the vector of channels
@ -882,14 +894,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{ {
//(i.e. Acquisition_1C0.implementation=xxxx) //(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property( std::string acquisition_implementation_specific = configuration->property(
"Acquisition_1B" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Acquisition_1B" + std::to_string(channel_absolute_id) + ".implementation",
acquisition_implementation); acquisition_implementation);
//(i.e. Tracking_1C0.implementation=xxxx) //(i.e. Tracking_1C0.implementation=xxxx)
std::string tracking_implementation_specific = configuration->property( std::string tracking_implementation_specific = configuration->property(
"Tracking_1B" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Tracking_1B" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation); tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property( std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_1B" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "TelemetryDecoder_1B" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation); telemetry_decoder_implementation);
// Push back the channel to the vector of channels // Push back the channel to the vector of channels
@ -911,14 +923,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{ {
//(i.e. Acquisition_1C0.implementation=xxxx) //(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property( std::string acquisition_implementation_specific = configuration->property(
"Acquisition_5X" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Acquisition_5X" + std::to_string(channel_absolute_id) + ".implementation",
acquisition_implementation); acquisition_implementation);
//(i.e. Tracking_1C0.implementation=xxxx) //(i.e. Tracking_1C0.implementation=xxxx)
std::string tracking_implementation_specific = configuration->property( std::string tracking_implementation_specific = configuration->property(
"Tracking_5X" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Tracking_5X" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation); tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property( std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_5X" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "TelemetryDecoder_5X" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation); telemetry_decoder_implementation);
// Push back the channel to the vector of channels // Push back the channel to the vector of channels
@ -941,14 +953,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{ {
//(i.e. Acquisition_1G0.implementation=xxxx) //(i.e. Acquisition_1G0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property( std::string acquisition_implementation_specific = configuration->property(
"Acquisition_1G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Acquisition_1G" + std::to_string(channel_absolute_id) + ".implementation",
acquisition_implementation); acquisition_implementation);
//(i.e. Tracking_1G0.implementation=xxxx) //(i.e. Tracking_1G0.implementation=xxxx)
std::string tracking_implementation_specific = configuration->property( std::string tracking_implementation_specific = configuration->property(
"Tracking_1G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Tracking_1G" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation); tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property( std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_1G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "TelemetryDecoder_1G" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation); telemetry_decoder_implementation);
// Push back the channel to the vector of channels // Push back the channel to the vector of channels
@ -971,14 +983,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{ {
//(i.e. Acquisition_2G0.implementation=xxxx) //(i.e. Acquisition_2G0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property( std::string acquisition_implementation_specific = configuration->property(
"Acquisition_2G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Acquisition_2G" + std::to_string(channel_absolute_id) + ".implementation",
acquisition_implementation); acquisition_implementation);
//(i.e. Tracking_2G0.implementation=xxxx) //(i.e. Tracking_2G0.implementation=xxxx)
std::string tracking_implementation_specific = configuration->property( std::string tracking_implementation_specific = configuration->property(
"Tracking_2G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "Tracking_2G" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation); tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property( std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_2G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation", "TelemetryDecoder_2G" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation); telemetry_decoder_implementation);
// Push back the channel to the vector of channels // Push back the channel to the vector of channels
@ -990,6 +1002,11 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
queue)); queue));
channel_absolute_id++; channel_absolute_id++;
} }
}
catch (const std::exception &e)
{
LOG(WARNING) << e.what();
}
return channels; return channels;
} }

View File

@ -310,7 +310,6 @@ void GNSSFlowgraph::connect()
return; return;
} }
} }
#else #else
// connect the signal source to sample counter // connect the signal source to sample counter
// connect the sample counter to Observables // connect the sample counter to Observables
@ -341,7 +340,14 @@ void GNSSFlowgraph::connect()
{ {
if (FPGA_enabled == false) if (FPGA_enabled == false)
{ {
selected_signal_conditioner_ID = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".RF_channel_ID", 0); try
{
selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0);
}
catch (const std::exception& e)
{
LOG(WARNING) << e.what();
}
try try
{ {
top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0,
@ -376,7 +382,15 @@ void GNSSFlowgraph::connect()
std::vector<unsigned int> vector_of_channels; std::vector<unsigned int> vector_of_channels;
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{ {
unsigned int sat = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".satellite", 0); unsigned int sat = 0;
try
{
sat = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0);
}
catch (const std::exception& e)
{
LOG(WARNING) << e.what();
}
if (sat == 0) if (sat == 0)
{ {
vector_of_channels.push_back(i); vector_of_channels.push_back(i);
@ -392,7 +406,15 @@ void GNSSFlowgraph::connect()
for (unsigned int& i : vector_of_channels) for (unsigned int& i : vector_of_channels)
{ {
std::string gnss_signal = channels_.at(i)->get_signal().get_signal_str(); // use channel's implicit signal std::string gnss_signal = channels_.at(i)->get_signal().get_signal_str(); // use channel's implicit signal
unsigned int sat = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".satellite", 0); unsigned int sat = 0;
try
{
sat = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0);
}
catch (const std::exception& e)
{
LOG(WARNING) << e.what();
}
if (sat == 0) if (sat == 0)
{ {
channels_.at(i)->set_signal(search_next_signal(gnss_signal, true)); channels_.at(i)->set_signal(search_next_signal(gnss_signal, true));
@ -459,7 +481,7 @@ void GNSSFlowgraph::disconnect()
LOG(INFO) << "flowgraph was not connected"; LOG(INFO) << "flowgraph was not connected";
return; return;
} }
connected_ = false;
// Signal Source (i) > Signal conditioner (i) > // Signal Source (i) > Signal conditioner (i) >
int RF_Channels = 0; int RF_Channels = 0;
int signal_conditioner_ID = 0; int signal_conditioner_ID = 0;
@ -511,24 +533,77 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect signal source " << i << " to signal conditioner " << i << ": " << e.what(); LOG(INFO) << "Can't disconnect signal source " << i << " to signal conditioner " << i << ": " << e.what();
top_block_->disconnect_all();
return;
} }
} }
bool FPGA_enabled = configuration_->property(sig_source_.at(0)->role() + ".enable_FPGA", false);
#if ENABLE_FPGA
if (FPGA_enabled == false)
{
// disconnect the signal source to sample counter
// disconnect the sample counter to Observables
try try
{ {
top_block_->disconnect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0); top_block_->disconnect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
top_block_->disconnect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); //extra port for the sample counter pulse top_block_->disconnect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); // extra port for the sample counter pulse
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect sample counter: " << e.what(); LOG(WARNING) << "Can't disconnect sample counter";
LOG(ERROR) << e.what();
top_block_->disconnect_all();
return;
} }
}
else
{
try
{
top_block_->disconnect(null_source_, 0, throttle_, 0);
top_block_->disconnect(throttle_, 0, time_counter_, 0);
top_block_->disconnect(time_counter_, 0, observables_->get_left_block(), channels_count_);
}
catch (const std::exception& e)
{
LOG(WARNING) << "Can't connect sample counter";
LOG(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
}
#else
// disconnect the signal source to sample counter
// disconnect the sample counter to Observables
try
{
top_block_->disconnect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
top_block_->disconnect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); // extra port for the sample counter pulse
}
catch (const std::exception& e)
{
LOG(WARNING) << "Can't connect sample counter";
LOG(ERROR) << e.what();
top_block_->disconnect_all();
return;
}
#endif
// Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID) // Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID)
int selected_signal_conditioner_ID; int selected_signal_conditioner_ID;
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{ {
selected_signal_conditioner_ID = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".RF_channel_ID", 0); try
{
selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0);
}
catch (const std::exception& e)
{
LOG(WARNING) << e.what();
top_block_->disconnect_all();
return;
}
try try
{ {
top_block_->disconnect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, top_block_->disconnect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0,
@ -537,6 +612,8 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect signal conditioner " << selected_signal_conditioner_ID << " to channel " << i << ": " << e.what(); LOG(INFO) << "Can't disconnect signal conditioner " << selected_signal_conditioner_ID << " to channel " << i << ": " << e.what();
top_block_->disconnect_all();
return;
} }
// Signal Source > Signal conditioner >> Channels >> Observables // Signal Source > Signal conditioner >> Channels >> Observables
@ -548,6 +625,8 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect channel " << i << " to observables: " << e.what(); LOG(INFO) << "Can't disconnect channel " << i << " to observables: " << e.what();
top_block_->disconnect_all();
return;
} }
} }
@ -562,6 +641,8 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect observables to PVT: " << e.what(); LOG(INFO) << "Can't disconnect observables to PVT: " << e.what();
top_block_->disconnect_all();
return;
} }
for (int i = 0; i < sources_count_; i++) for (int i = 0; i < sources_count_; i++)
@ -573,6 +654,8 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect signal source block " << i << " internally: " << e.what(); LOG(INFO) << "Can't disconnect signal source block " << i << " internally: " << e.what();
top_block_->disconnect_all();
return;
} }
} }
@ -586,6 +669,8 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect signal conditioner block " << i << " internally: " << e.what(); LOG(INFO) << "Can't disconnect signal conditioner block " << i << " internally: " << e.what();
top_block_->disconnect_all();
return;
} }
} }
@ -598,6 +683,8 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect channel " << i << " internally: " << e.what(); LOG(INFO) << "Can't disconnect channel " << i << " internally: " << e.what();
top_block_->disconnect_all();
return;
} }
} }
@ -608,6 +695,8 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect observables block internally: " << e.what(); LOG(INFO) << "Can't disconnect observables block internally: " << e.what();
top_block_->disconnect_all();
return;
} }
// Signal Source > Signal conditioner >> Channels >> Observables > PVT // Signal Source > Signal conditioner >> Channels >> Observables > PVT
@ -618,11 +707,11 @@ void GNSSFlowgraph::disconnect()
catch (const std::exception& e) catch (const std::exception& e)
{ {
LOG(INFO) << "Can't disconnect PVT block internally: " << e.what(); LOG(INFO) << "Can't disconnect PVT block internally: " << e.what();
top_block_->disconnect_all();
return;
} }
DLOG(INFO) << "blocks disconnected internally"; DLOG(INFO) << "blocks disconnected internally";
connected_ = false;
LOG(INFO) << "Flowgraph disconnected"; LOG(INFO) << "Flowgraph disconnected";
} }
@ -658,7 +747,15 @@ bool GNSSFlowgraph::send_telemetry_msg(pmt::pmt_t msg)
void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
{ {
DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_; DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_;
unsigned int sat = configuration_->property("Channel" + boost::lexical_cast<std::string>(who) + ".satellite", 0); unsigned int sat = 0;
try
{
sat = configuration_->property("Channel" + std::to_string(who) + ".satellite", 0);
}
catch (const std::exception& e)
{
LOG(WARNING) << e.what();
}
switch (what) switch (what)
{ {
case 0: case 0:
@ -679,7 +776,15 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
acq_channels_count_--; acq_channels_count_--;
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)
{ {
unsigned int sat_ = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".satellite", 0); unsigned int sat_ = 0;
try
{
sat_ = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0);
}
catch (const std::exception& e)
{
LOG(WARNING) << e.what();
}
if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0))
{ {
channels_state_[i] = 1; channels_state_[i] = 1;
@ -828,7 +933,7 @@ void GNSSFlowgraph::init()
std::cout << "Please update your configuration file." << std::endl; std::cout << "Please update your configuration file." << std::endl;
} }
std::shared_ptr<std::vector<std::unique_ptr<GNSSBlockInterface> > > channels = block_factory_->GetChannels(configuration_, queue_); std::shared_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = block_factory_->GetChannels(configuration_, queue_);
channels_count_ = channels->size(); channels_count_ = channels->size();
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)