mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
Add RX time counter
This commit is contained in:
parent
5e2aa437ef
commit
1428630e79
@ -18,27 +18,52 @@
|
|||||||
|
|
||||||
add_subdirectory(rtklib)
|
add_subdirectory(rtklib)
|
||||||
|
|
||||||
set(GNSS_SPLIBS_SOURCES
|
if(ENABLE_FPGA)
|
||||||
gps_l2c_signal.cc
|
set(GNSS_SPLIBS_SOURCES
|
||||||
gps_l5_signal.cc
|
gps_l2c_signal.cc
|
||||||
galileo_e1_signal_processing.cc
|
gps_l5_signal.cc
|
||||||
gnss_sdr_valve.cc
|
galileo_e1_signal_processing.cc
|
||||||
gnss_sdr_sample_counter.cc
|
gnss_sdr_valve.cc
|
||||||
gnss_signal_processing.cc
|
gnss_sdr_sample_counter.cc
|
||||||
gps_sdr_signal_processing.cc
|
gnss_sdr_time_counter.cc
|
||||||
glonass_l1_signal_processing.cc
|
gnss_signal_processing.cc
|
||||||
glonass_l2_signal_processing.cc
|
gps_sdr_signal_processing.cc
|
||||||
pass_through.cc
|
glonass_l1_signal_processing.cc
|
||||||
galileo_e5_signal_processing.cc
|
glonass_l2_signal_processing.cc
|
||||||
complex_byte_to_float_x2.cc
|
pass_through.cc
|
||||||
byte_x2_to_complex_byte.cc
|
galileo_e5_signal_processing.cc
|
||||||
cshort_to_float_x2.cc
|
complex_byte_to_float_x2.cc
|
||||||
short_x2_to_cshort.cc
|
byte_x2_to_complex_byte.cc
|
||||||
complex_float_to_complex_byte.cc
|
cshort_to_float_x2.cc
|
||||||
conjugate_cc.cc
|
short_x2_to_cshort.cc
|
||||||
conjugate_sc.cc
|
complex_float_to_complex_byte.cc
|
||||||
conjugate_ic.cc
|
conjugate_cc.cc
|
||||||
)
|
conjugate_sc.cc
|
||||||
|
conjugate_ic.cc
|
||||||
|
)
|
||||||
|
else(ENABLE_FPGA)
|
||||||
|
set(GNSS_SPLIBS_SOURCES
|
||||||
|
gps_l2c_signal.cc
|
||||||
|
gps_l5_signal.cc
|
||||||
|
galileo_e1_signal_processing.cc
|
||||||
|
gnss_sdr_valve.cc
|
||||||
|
gnss_sdr_sample_counter.cc
|
||||||
|
gnss_signal_processing.cc
|
||||||
|
gps_sdr_signal_processing.cc
|
||||||
|
glonass_l1_signal_processing.cc
|
||||||
|
glonass_l2_signal_processing.cc
|
||||||
|
pass_through.cc
|
||||||
|
galileo_e5_signal_processing.cc
|
||||||
|
complex_byte_to_float_x2.cc
|
||||||
|
byte_x2_to_complex_byte.cc
|
||||||
|
cshort_to_float_x2.cc
|
||||||
|
short_x2_to_cshort.cc
|
||||||
|
complex_float_to_complex_byte.cc
|
||||||
|
conjugate_cc.cc
|
||||||
|
conjugate_sc.cc
|
||||||
|
conjugate_ic.cc
|
||||||
|
)
|
||||||
|
endif(ENABLE_FPGA)
|
||||||
|
|
||||||
if(OPENCL_FOUND)
|
if(OPENCL_FOUND)
|
||||||
set(GNSS_SPLIBS_SOURCES ${GNSS_SPLIBS_SOURCES}
|
set(GNSS_SPLIBS_SOURCES ${GNSS_SPLIBS_SOURCES}
|
||||||
|
126
src/algorithms/libs/gnss_sdr_time_counter.cc
Normal file
126
src/algorithms/libs/gnss_sdr_time_counter.cc
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/*!
|
||||||
|
* \file gnss_sdr_time_counter.cc
|
||||||
|
* \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks
|
||||||
|
* \author Antonio Ramos 2018. antonio.ramos(at)gmail.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gnss_sdr_time_counter.h"
|
||||||
|
#include "gnss_synchro.h"
|
||||||
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <cmath>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
gnss_sdr_time_counter::gnss_sdr_time_counter() : gr::block("time_counter",
|
||||||
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||||
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||||
|
{
|
||||||
|
set_max_noutput_items(1);
|
||||||
|
current_T_rx_ms = 0;
|
||||||
|
current_s = 0;
|
||||||
|
current_m = 0;
|
||||||
|
current_h = 0;
|
||||||
|
current_days = 0;
|
||||||
|
report_interval_ms = 1000; // default reporting 1 second
|
||||||
|
flag_m = false;
|
||||||
|
flag_h = false;
|
||||||
|
flag_days = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter()
|
||||||
|
{
|
||||||
|
gnss_sdr_time_counter_sptr counter_(new gnss_sdr_time_counter());
|
||||||
|
return counter_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int gnss_sdr_time_counter::general_work(int noutput_items __attribute__((unused)),
|
||||||
|
gr_vector_const_void_star &input_items __attribute__((unused)),
|
||||||
|
gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]);
|
||||||
|
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]);
|
||||||
|
out[0] = in[0];
|
||||||
|
if ((current_T_rx_ms % report_interval_ms) == 0)
|
||||||
|
{
|
||||||
|
current_s++;
|
||||||
|
if ((current_s % 60) == 0)
|
||||||
|
{
|
||||||
|
current_s = 0;
|
||||||
|
current_m++;
|
||||||
|
flag_m = true;
|
||||||
|
if ((current_m % 60) == 0)
|
||||||
|
{
|
||||||
|
current_m = 0;
|
||||||
|
current_h++;
|
||||||
|
flag_h = true;
|
||||||
|
if ((current_h % 24) == 0)
|
||||||
|
{
|
||||||
|
current_h = 0;
|
||||||
|
current_days++;
|
||||||
|
flag_days = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flag_days)
|
||||||
|
{
|
||||||
|
std::string day;
|
||||||
|
if (current_days == 1)
|
||||||
|
{
|
||||||
|
day = " day ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
day = " days ";
|
||||||
|
}
|
||||||
|
std::cout << "Current receiver time: " << current_days << day << current_h << " h " << current_m << " min " << current_s << " s" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (flag_h)
|
||||||
|
{
|
||||||
|
std::cout << "Current receiver time: " << current_h << " h " << current_m << " min " << current_s << " s" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (flag_m)
|
||||||
|
{
|
||||||
|
std::cout << "Current receiver time: " << current_m << " min " << current_s << " s" << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Current receiver time: " << current_s << " s" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
current_T_rx_ms++;
|
||||||
|
return 1;
|
||||||
|
}
|
65
src/algorithms/libs/gnss_sdr_time_counter.h
Normal file
65
src/algorithms/libs/gnss_sdr_time_counter.h
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*!
|
||||||
|
* \file gnss_sdr_time_counter.h
|
||||||
|
* \brief Simple block to report the current receiver time based on the output of the tracking or telemetry blocks
|
||||||
|
* \author Antonio Ramos 2018. antonio.ramosdet(at)gmail.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#ifndef GNSS_SDR_TIME_COUNTER_H_
|
||||||
|
#define GNSS_SDR_TIME_COUNTER_H_
|
||||||
|
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
class gnss_sdr_time_counter;
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<gnss_sdr_time_counter> gnss_sdr_time_counter_sptr;
|
||||||
|
|
||||||
|
gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
|
||||||
|
|
||||||
|
class gnss_sdr_time_counter : public gr::block
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
gnss_sdr_time_counter();
|
||||||
|
long long int current_T_rx_ms; // Receiver time in ms since the beginning of the run
|
||||||
|
unsigned int current_s; // Receiver time in seconds, modulo 60
|
||||||
|
bool flag_m; // True if the receiver has been running for at least 1 minute
|
||||||
|
unsigned int current_m; // Receiver time in minutes, modulo 60
|
||||||
|
bool flag_h; // True if the receiver has been running for at least 1 hour
|
||||||
|
unsigned int current_h; // Receiver time in hours, modulo 24
|
||||||
|
bool flag_days; // True if the receiver has been running for at least 1 day
|
||||||
|
unsigned int current_days; // Receiver time in days since the beginning of the run
|
||||||
|
int report_interval_ms;
|
||||||
|
|
||||||
|
public:
|
||||||
|
friend gnss_sdr_time_counter_sptr gnss_sdr_make_time_counter();
|
||||||
|
int general_work(int noutput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_SAMPLE_COUNTER_H_*/
|
@ -62,8 +62,6 @@ GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configurati
|
|||||||
|
|
||||||
|
|
||||||
GNSSFlowgraph::~GNSSFlowgraph() {}
|
GNSSFlowgraph::~GNSSFlowgraph() {}
|
||||||
|
|
||||||
|
|
||||||
void GNSSFlowgraph::start()
|
void GNSSFlowgraph::start()
|
||||||
{
|
{
|
||||||
if (running_)
|
if (running_)
|
||||||
@ -108,41 +106,41 @@ void GNSSFlowgraph::connect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < sources_count_; i++)
|
for (int i = 0; i < sources_count_; i++)
|
||||||
{
|
|
||||||
if (configuration_->property(sig_source_.at(i)->role() + ".enable_FPGA", false)==false)
|
|
||||||
{
|
{
|
||||||
try
|
if (configuration_->property(sig_source_.at(i)->role() + ".enable_FPGA", false) == false)
|
||||||
{
|
{
|
||||||
sig_source_.at(i)->connect(top_block_);
|
try
|
||||||
}
|
{
|
||||||
catch (const std::exception& e)
|
sig_source_.at(i)->connect(top_block_);
|
||||||
{
|
}
|
||||||
LOG(INFO) << "Can't connect signal source block " << i << " internally";
|
catch (const std::exception& e)
|
||||||
LOG(ERROR) << e.what();
|
{
|
||||||
top_block_->disconnect_all();
|
LOG(INFO) << "Can't connect signal source block " << i << " internally";
|
||||||
return;
|
LOG(ERROR) << e.what();
|
||||||
|
top_block_->disconnect_all();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Signal Source > Signal conditioner >
|
// Signal Source > Signal conditioner >
|
||||||
for (unsigned int i = 0; i < sig_conditioner_.size(); i++)
|
for (unsigned int i = 0; i < sig_conditioner_.size(); i++)
|
||||||
{
|
|
||||||
if (configuration_->property(sig_conditioner_.at(i)->role() + ".enable_FPGA", false)==false)
|
|
||||||
{
|
{
|
||||||
try
|
if (configuration_->property(sig_conditioner_.at(i)->role() + ".enable_FPGA", false) == false)
|
||||||
{
|
{
|
||||||
sig_conditioner_.at(i)->connect(top_block_);
|
try
|
||||||
}
|
{
|
||||||
catch (const std::exception& e)
|
sig_conditioner_.at(i)->connect(top_block_);
|
||||||
{
|
}
|
||||||
LOG(INFO) << "Can't connect signal conditioner block " << i << " internally";
|
catch (const std::exception& e)
|
||||||
LOG(ERROR) << e.what();
|
{
|
||||||
top_block_->disconnect_all();
|
LOG(INFO) << "Can't connect signal conditioner block " << i << " internally";
|
||||||
return;
|
LOG(ERROR) << e.what();
|
||||||
|
top_block_->disconnect_all();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < channels_count_; i++)
|
for (unsigned int i = 0; i < channels_count_; i++)
|
||||||
{
|
{
|
||||||
@ -191,144 +189,173 @@ void GNSSFlowgraph::connect()
|
|||||||
|
|
||||||
for (int i = 0; i < sources_count_; i++)
|
for (int i = 0; i < sources_count_; i++)
|
||||||
{
|
{
|
||||||
//FPGA Accelerators do not need signal sources or conditioners
|
//FPGA Accelerators do not need signal sources or conditioners
|
||||||
//as the samples are feed directly to the FPGA fabric, so, if enabled, do not connect any source
|
//as the samples are feed directly to the FPGA fabric, so, if enabled, do not connect any source
|
||||||
if (configuration_->property(sig_source_.at(i)->role() + ".enable_FPGA", false)==false)
|
if (configuration_->property(sig_source_.at(i)->role() + ".enable_FPGA", false) == false)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
//TODO: Remove this array implementation and create generic multistream connector
|
try
|
||||||
//(if a signal source has more than 1 stream, then connect it to the multistream signal conditioner)
|
|
||||||
if (sig_source_.at(i)->implementation().compare("Raw_Array_Signal_Source") == 0)
|
|
||||||
{
|
{
|
||||||
//Multichannel Array
|
//TODO: Remove this array implementation and create generic multistream connector
|
||||||
std::cout << "ARRAY MODE" << std::endl;
|
//(if a signal source has more than 1 stream, then connect it to the multistream signal conditioner)
|
||||||
for (int j = 0; j < GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS; j++)
|
if (sig_source_.at(i)->implementation().compare("Raw_Array_Signal_Source") == 0)
|
||||||
{
|
{
|
||||||
std::cout << "connecting ch " << j << std::endl;
|
//Multichannel Array
|
||||||
top_block_->connect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(i)->get_left_block(), j);
|
std::cout << "ARRAY MODE" << std::endl;
|
||||||
}
|
for (int j = 0; j < GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS; j++)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
|
||||||
//Include GetRFChannels in the interface to avoid read config parameters here
|
|
||||||
//read the number of RF channels for each front-end
|
|
||||||
RF_Channels = configuration_->property(sig_source_.at(i)->role() + ".RF_channels", 1);
|
|
||||||
|
|
||||||
for (int j = 0; j < RF_Channels; j++)
|
|
||||||
{
|
|
||||||
//Connect the multichannel signal source to multiple signal conditioners
|
|
||||||
// GNURADIO max_streams=-1 means infinite ports!
|
|
||||||
LOG(INFO) << "sig_source_.at(i)->get_right_block()->output_signature()->max_streams()=" << sig_source_.at(i)->get_right_block()->output_signature()->max_streams();
|
|
||||||
LOG(INFO) << "sig_conditioner_.at(signal_conditioner_ID)->get_left_block()->input_signature()=" << sig_conditioner_.at(signal_conditioner_ID)->get_left_block()->input_signature()->max_streams();
|
|
||||||
|
|
||||||
if (sig_source_.at(i)->get_right_block()->output_signature()->max_streams() > 1)
|
|
||||||
{
|
{
|
||||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << j;
|
std::cout << "connecting ch " << j << std::endl;
|
||||||
top_block_->connect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
top_block_->connect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(i)->get_left_block(), j);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
||||||
|
//Include GetRFChannels in the interface to avoid read config parameters here
|
||||||
|
//read the number of RF channels for each front-end
|
||||||
|
RF_Channels = configuration_->property(sig_source_.at(i)->role() + ".RF_channels", 1);
|
||||||
|
|
||||||
|
for (int j = 0; j < RF_Channels; j++)
|
||||||
{
|
{
|
||||||
if (j == 0)
|
//Connect the multichannel signal source to multiple signal conditioners
|
||||||
|
// GNURADIO max_streams=-1 means infinite ports!
|
||||||
|
LOG(INFO) << "sig_source_.at(i)->get_right_block()->output_signature()->max_streams()=" << sig_source_.at(i)->get_right_block()->output_signature()->max_streams();
|
||||||
|
LOG(INFO) << "sig_conditioner_.at(signal_conditioner_ID)->get_left_block()->input_signature()=" << sig_conditioner_.at(signal_conditioner_ID)->get_left_block()->input_signature()->max_streams();
|
||||||
|
|
||||||
|
if (sig_source_.at(i)->get_right_block()->output_signature()->max_streams() > 1)
|
||||||
{
|
{
|
||||||
// RF_channel 0 backward compatibility with single channel sources
|
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << j;
|
||||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << 0 << " to conditioner " << j;
|
top_block_->connect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||||
top_block_->connect(sig_source_.at(i)->get_right_block(), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Multiple channel sources using multiple output blocks of single channel (requires RF_channel selector in call)
|
if (j == 0)
|
||||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << j;
|
{
|
||||||
top_block_->connect(sig_source_.at(i)->get_right_block(j), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
// RF_channel 0 backward compatibility with single channel sources
|
||||||
|
LOG(INFO) << "connecting sig_source_ " << i << " stream " << 0 << " to conditioner " << j;
|
||||||
|
top_block_->connect(sig_source_.at(i)->get_right_block(), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Multiple channel sources using multiple output blocks of single channel (requires RF_channel selector in call)
|
||||||
|
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << j;
|
||||||
|
top_block_->connect(sig_source_.at(i)->get_right_block(j), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
signal_conditioner_ID++;
|
||||||
}
|
}
|
||||||
signal_conditioner_ID++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Can't connect signal source " << i << " to signal conditioner " << i;
|
||||||
|
LOG(ERROR) << e.what();
|
||||||
|
top_block_->disconnect_all();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DLOG(INFO) << "Signal source connected to signal conditioner";
|
||||||
|
bool FPGA_enabled = configuration_->property(sig_source_.at(0)->role() + ".enable_FPGA", false);
|
||||||
|
|
||||||
|
#if ENABLE_FPGA
|
||||||
|
|
||||||
|
if (FPGA_enabled == false)
|
||||||
|
{
|
||||||
|
//connect the signal source to sample counter
|
||||||
|
//connect the sample counter to Observables
|
||||||
|
try
|
||||||
|
{
|
||||||
|
double fs = static_cast<double>(configuration_->property("GNSS-SDR.internal_fs_sps", 0));
|
||||||
|
if (fs == 0.0)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Set GNSS-SDR.internal_fs_sps in configuration file";
|
||||||
|
std::cout << "Set GNSS-SDR.internal_fs_sps in configuration file" << std::endl;
|
||||||
|
throw(std::invalid_argument("Set GNSS-SDR.internal_fs_sps in configuration"));
|
||||||
|
}
|
||||||
|
ch_out_sample_counter = gnss_sdr_make_sample_counter(fs, sig_conditioner_.at(0)->get_right_block()->output_signature()->sizeof_stream_item(0));
|
||||||
|
top_block_->connect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
|
||||||
|
top_block_->connect(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(WARNING) << "Can't connect signal source " << i << " to signal conditioner " << i;
|
LOG(WARNING) << "Can't connect sample counter";
|
||||||
|
LOG(ERROR) << e.what();
|
||||||
|
top_block_->disconnect_all();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//create a software-defined 1kHz gnss_synchro pulse for the observables block
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//null source
|
||||||
|
null_source_ = gr::blocks::null_source::make(sizeof(Gnss_Synchro));
|
||||||
|
//throttle 1kHz
|
||||||
|
throttle_ = gr::blocks::throttle::make(sizeof(Gnss_Synchro), 1000); // 1000 samples per second (1kHz)
|
||||||
|
time_counter_ = gnss_sdr_make_time_counter();
|
||||||
|
top_block_->connect(null_source_, 0, throttle_, 0);
|
||||||
|
top_block_->connect(throttle_, 0, time_counter_, 0);
|
||||||
|
top_block_->connect(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();
|
LOG(ERROR) << e.what();
|
||||||
top_block_->disconnect_all();
|
top_block_->disconnect_all();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
DLOG(INFO) << "Signal source connected to signal conditioner";
|
|
||||||
|
|
||||||
bool FPGA_enabled = configuration_->property(sig_source_.at(0)->role() + ".enable_FPGA", false);
|
#else
|
||||||
|
|
||||||
if (FPGA_enabled==false)
|
//connect the signal source to sample counter
|
||||||
{
|
//connect the sample counter to Observables
|
||||||
//connect the signal source to sample counter
|
try
|
||||||
//connect the sample counter to Observables
|
{
|
||||||
try
|
double fs = static_cast<double>(configuration_->property("GNSS-SDR.internal_fs_sps", 0));
|
||||||
{
|
if (fs == 0.0)
|
||||||
double fs = static_cast<double>(configuration_->property("GNSS-SDR.internal_fs_sps", 0));
|
{
|
||||||
if (fs == 0.0)
|
LOG(WARNING) << "Set GNSS-SDR.internal_fs_sps in configuration file";
|
||||||
{
|
std::cout << "Set GNSS-SDR.internal_fs_sps in configuration file" << std::endl;
|
||||||
LOG(WARNING) << "Set GNSS-SDR.internal_fs_sps in configuration file";
|
throw(std::invalid_argument("Set GNSS-SDR.internal_fs_sps in configuration"));
|
||||||
std::cout << "Set GNSS-SDR.internal_fs_sps in configuration file" << std::endl;
|
}
|
||||||
throw(std::invalid_argument("Set GNSS-SDR.internal_fs_sps in configuration"));
|
ch_out_sample_counter = gnss_sdr_make_sample_counter(fs, sig_conditioner_.at(0)->get_right_block()->output_signature()->sizeof_stream_item(0));
|
||||||
}
|
top_block_->connect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
|
||||||
ch_out_sample_counter = gnss_sdr_make_sample_counter(fs, sig_conditioner_.at(0)->get_right_block()->output_signature()->sizeof_stream_item(0));
|
top_block_->connect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); //extra port for the sample counter pulse
|
||||||
top_block_->connect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0);
|
}
|
||||||
top_block_->connect(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(WARNING) << "Can't connect sample counter";
|
||||||
{
|
LOG(ERROR) << e.what();
|
||||||
LOG(WARNING) << "Can't connect sample counter";
|
top_block_->disconnect_all();
|
||||||
LOG(ERROR) << e.what();
|
return;
|
||||||
top_block_->disconnect_all();
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
//create a software-defined 1kHz gnss_synchro pulse for the observables block
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//null source
|
|
||||||
null_source_= gr::blocks::null_source::make(sizeof(Gnss_Synchro));
|
|
||||||
//throttle 1kHz
|
|
||||||
throttle_ = gr::blocks::throttle::make(sizeof(Gnss_Synchro),1000);// 1000 samples per second (1kHz)
|
|
||||||
top_block_->connect(null_source_, 0, throttle_, 0);
|
|
||||||
top_block_->connect(throttle_, 0, observables_->get_left_block(), channels_count_); //extra port for the sample counter pulse
|
|
||||||
|
|
||||||
}
|
#endif
|
||||||
catch (const std::exception& e)
|
|
||||||
{
|
|
||||||
LOG(WARNING) << "Can't connect sample counter";
|
|
||||||
LOG(ERROR) << e.what();
|
|
||||||
top_block_->disconnect_all();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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++)
|
||||||
{
|
{
|
||||||
|
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
|
|
||||||
{
|
{
|
||||||
top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0,
|
selected_signal_conditioner_ID = configuration_->property("Channel" + boost::lexical_cast<std::string>(i) + ".RF_channel_ID", 0);
|
||||||
channels_.at(i)->get_left_block(), 0);
|
try
|
||||||
}
|
{
|
||||||
catch (const std::exception& e)
|
top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0,
|
||||||
{
|
channels_.at(i)->get_left_block(), 0);
|
||||||
LOG(WARNING) << "Can't connect signal conditioner " << selected_signal_conditioner_ID << " to channel " << i;
|
}
|
||||||
LOG(ERROR) << e.what();
|
catch (const std::exception& e)
|
||||||
top_block_->disconnect_all();
|
{
|
||||||
return;
|
LOG(WARNING) << "Can't connect signal conditioner " << selected_signal_conditioner_ID << " to channel " << i;
|
||||||
}
|
LOG(ERROR) << e.what();
|
||||||
|
top_block_->disconnect_all();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DLOG(INFO) << "signal conditioner " << selected_signal_conditioner_ID << " connected to channel " << i;
|
DLOG(INFO) << "signal conditioner " << selected_signal_conditioner_ID << " connected to channel " << i;
|
||||||
}
|
}
|
||||||
// Signal Source > Signal conditioner >> Channels >> Observables
|
// Signal Source > Signal conditioner >> Channels >> Observables
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -348,10 +375,10 @@ void GNSSFlowgraph::connect()
|
|||||||
|
|
||||||
if (channels_state_[i] == 1)
|
if (channels_state_[i] == 1)
|
||||||
{
|
{
|
||||||
if (FPGA_enabled == false)
|
if (FPGA_enabled == false)
|
||||||
{
|
{
|
||||||
channels_.at(i)->start_acquisition();
|
channels_.at(i)->start_acquisition();
|
||||||
}
|
}
|
||||||
available_GNSS_signals_.pop_front();
|
available_GNSS_signals_.pop_front();
|
||||||
LOG(INFO) << "Channel " << i << " assigned to " << channels_.at(i)->get_signal();
|
LOG(INFO) << "Channel " << i << " assigned to " << channels_.at(i)->get_signal();
|
||||||
LOG(INFO) << "Channel " << i << " connected to observables and ready for acquisition";
|
LOG(INFO) << "Channel " << i << " connected to observables and ready for acquisition";
|
||||||
@ -491,12 +518,12 @@ void GNSSFlowgraph::set_configuration(std::shared_ptr<ConfigurationInterface> co
|
|||||||
void GNSSFlowgraph::start_acquisition_helper()
|
void GNSSFlowgraph::start_acquisition_helper()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < channels_count_; i++)
|
for (unsigned int i = 0; i < channels_count_; i++)
|
||||||
{
|
{
|
||||||
if (channels_state_[i] == 1)
|
if (channels_state_[i] == 1)
|
||||||
{
|
{
|
||||||
channels_.at(i)->start_acquisition();
|
channels_.at(i)->start_acquisition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GNSSFlowgraph::init()
|
void GNSSFlowgraph::init()
|
||||||
|
@ -49,6 +49,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if ENABLE_FPGA
|
||||||
|
#include "gnss_sdr_time_counter.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class GNSSBlockInterface;
|
class GNSSBlockInterface;
|
||||||
class ChannelInterface;
|
class ChannelInterface;
|
||||||
@ -144,6 +147,9 @@ private:
|
|||||||
|
|
||||||
std::vector<std::shared_ptr<ChannelInterface>> channels_;
|
std::vector<std::shared_ptr<ChannelInterface>> channels_;
|
||||||
gnss_sdr_sample_counter_sptr ch_out_sample_counter;
|
gnss_sdr_sample_counter_sptr ch_out_sample_counter;
|
||||||
|
#if ENABLE_FPGA
|
||||||
|
gnss_sdr_time_counter_sptr time_counter_;
|
||||||
|
#endif
|
||||||
gr::blocks::null_source::sptr null_source_;
|
gr::blocks::null_source::sptr null_source_;
|
||||||
gr::blocks::throttle::sptr throttle_;
|
gr::blocks::throttle::sptr throttle_;
|
||||||
gr::top_block_sptr top_block_;
|
gr::top_block_sptr top_block_;
|
||||||
|
Loading…
Reference in New Issue
Block a user