mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-19 16:45:17 +00:00
Merge branch 'next' of https://github.com/mmajoral/gnss-sdr into fpga_extended_coherent_integration
This commit is contained in:
@@ -39,6 +39,8 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
|
||||
BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
|
||||
@@ -90,7 +92,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
|
||||
vector_length_ *= 2;
|
||||
}
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "cshort")
|
||||
{
|
||||
@@ -123,7 +125,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -135,10 +137,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
|
||||
}
|
||||
|
||||
|
||||
BeidouB1iPcpsAcquisition::~BeidouB1iPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
BeidouB1iPcpsAcquisition::~BeidouB1iPcpsAcquisition() = default;
|
||||
|
||||
|
||||
void BeidouB1iPcpsAcquisition::stop_acquisition()
|
||||
@@ -204,18 +203,17 @@ void BeidouB1iPcpsAcquisition::init()
|
||||
|
||||
void BeidouB1iPcpsAcquisition::set_local_code()
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
beidou_b1i_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
for (uint32_t i = 0; i < sampled_ms_; i++)
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
@@ -331,6 +329,7 @@ gr::basic_block_sptr BeidouB1iPcpsAcquisition::get_right_block()
|
||||
return acquisition_;
|
||||
}
|
||||
|
||||
|
||||
void BeidouB1iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
|
||||
{
|
||||
acquisition_->set_resampler_latency(latency_samples);
|
||||
|
||||
@@ -42,7 +42,9 @@
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -100,15 +102,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -159,7 +160,6 @@ public:
|
||||
*/
|
||||
void set_resampler_latency(uint32_t latency_samples) override;
|
||||
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
@@ -183,12 +183,11 @@ private:
|
||||
bool dump_;
|
||||
bool blocking_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
uint32_t in_streams_;
|
||||
uint32_t out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using google::LogMessage;
|
||||
|
||||
@@ -66,7 +66,10 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
|
||||
blocking_ = configuration_->property(role + ".blocking", true);
|
||||
acq_parameters.blocking = blocking_;
|
||||
doppler_max_ = configuration_->property(role + ".doppler_max", 5000);
|
||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||
if (FLAGS_doppler_max != 0)
|
||||
{
|
||||
doppler_max_ = FLAGS_doppler_max;
|
||||
}
|
||||
acq_parameters.doppler_max = doppler_max_;
|
||||
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
||||
acq_parameters.sampled_ms = sampled_ms_;
|
||||
@@ -88,7 +91,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
|
||||
vector_length_ *= 2;
|
||||
}
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "cshort")
|
||||
{
|
||||
@@ -121,7 +124,7 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -133,16 +136,14 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition(
|
||||
}
|
||||
|
||||
|
||||
BeidouB3iPcpsAcquisition::~BeidouB3iPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
BeidouB3iPcpsAcquisition::~BeidouB3iPcpsAcquisition() = default;
|
||||
|
||||
|
||||
void BeidouB3iPcpsAcquisition::stop_acquisition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void BeidouB3iPcpsAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
float pfa = configuration_->property(role_ + ".pfa", 0.0);
|
||||
@@ -201,18 +202,17 @@ void BeidouB3iPcpsAcquisition::init()
|
||||
|
||||
void BeidouB3iPcpsAcquisition::set_local_code()
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
beidou_b3i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
beidou_b3i_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -99,15 +101,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -158,7 +159,6 @@ public:
|
||||
*/
|
||||
void set_resampler_latency(uint32_t latency_samples) override;
|
||||
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
@@ -182,12 +182,11 @@ private:
|
||||
bool dump_;
|
||||
bool blocking_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
|
||||
@@ -86,7 +87,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
|
||||
|
||||
int samples_per_ms = code_length_ / 4;
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -110,7 +111,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -122,10 +123,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GalileoE1Pcps8msAmbiguousAcquisition::~GalileoE1Pcps8msAmbiguousAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GalileoE1Pcps8msAmbiguousAcquisition::~GalileoE1Pcps8msAmbiguousAcquisition() = default;
|
||||
|
||||
|
||||
void GalileoE1Pcps8msAmbiguousAcquisition::stop_acquisition()
|
||||
@@ -216,20 +214,20 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
|
||||
bool cboc = configuration_->property(
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
|
||||
delete[] code;
|
||||
acquisition_cc_->set_local_code(code_.data());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,6 +240,7 @@ void GalileoE1Pcps8msAmbiguousAcquisition::reset()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
|
||||
{
|
||||
unsigned int frequency_bins = 0;
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#include "galileo_pcps_8ms_acquisition_cc.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -165,7 +167,7 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
@@ -126,7 +127,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
vector_length_ *= 2;
|
||||
}
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "cshort")
|
||||
{
|
||||
@@ -154,7 +155,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -166,16 +167,14 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisition::~GalileoE1PcpsAmbiguousAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GalileoE1PcpsAmbiguousAcquisition::~GalileoE1PcpsAmbiguousAcquisition() = default;
|
||||
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisition::stop_acquisition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
|
||||
@@ -242,45 +241,47 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
|
||||
bool cboc = configuration_->property(
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
gsl::span<std::complex<float>> code_span(code.get(), code_length_);
|
||||
|
||||
if (acquire_pilot_ == true)
|
||||
{
|
||||
//set local signal generator to Galileo E1 pilot component (1C)
|
||||
char pilot_signal[3] = "1C";
|
||||
std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}};
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
|
||||
galileo_e1_code_gen_complex_sampled(code_span, pilot_signal,
|
||||
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
|
||||
galileo_e1_code_gen_complex_sampled(code_span, pilot_signal,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
|
||||
galileo_e1_code_gen_complex_sampled(code_span, Signal_,
|
||||
cboc, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
|
||||
galileo_e1_code_gen_complex_sampled(code_span, Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gsl::span<gr_complex> code__span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code, sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code__span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -98,13 +100,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -153,10 +156,8 @@ public:
|
||||
/*!
|
||||
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
|
||||
*/
|
||||
|
||||
void set_resampler_latency(uint32_t latency_samples) override;
|
||||
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
Acq_Conf acq_parameters_;
|
||||
@@ -181,7 +182,7 @@ private:
|
||||
bool dump_;
|
||||
bool blocking_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
#include <cstring> // for memcpy
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
|
||||
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
|
||||
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
|
||||
@@ -108,11 +108,12 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
|
||||
// compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
|
||||
// a channel is assigned)
|
||||
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
|
||||
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
|
||||
std::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * GALILEO_E1_NUMBER_OF_CODES)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
float max; // temporary maxima search
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
|
||||
for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++)
|
||||
@@ -122,14 +123,14 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
if (acquire_pilot_ == true)
|
||||
{
|
||||
//set local signal generator to Galileo E1 pilot component (1C)
|
||||
char pilot_signal[3] = "1C";
|
||||
galileo_e1_code_gen_complex_sampled(code, pilot_signal,
|
||||
std::array<char, 3> pilot_signal = {{'1', 'C', '\0'}};
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), pilot_signal,
|
||||
cboc, PRN, fs_in, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
char data_signal[3] = "1B";
|
||||
galileo_e1_code_gen_complex_sampled(code, data_signal,
|
||||
std::array<char, 3> data_signal = {{'1', 'B', '\0'}};
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), data_signal,
|
||||
cboc, PRN, fs_in, 0, false);
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
code[s] = std::complex<float>(0.0, 0.0);
|
||||
}
|
||||
|
||||
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer
|
||||
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
|
||||
fft_if->execute(); // Run the FFT of local code
|
||||
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
|
||||
|
||||
@@ -173,7 +174,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
}
|
||||
}
|
||||
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_;
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
|
||||
|
||||
acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4);
|
||||
acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0);
|
||||
@@ -188,17 +189,12 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
// temporary buffers that we can delete
|
||||
delete[] code;
|
||||
delete fft_if;
|
||||
delete[] fft_codes_padded;
|
||||
// temporary buffers that we can release
|
||||
volk_gnsssdr_free(fft_codes_padded);
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionFpga::~GalileoE1PcpsAmbiguousAcquisitionFpga()
|
||||
{
|
||||
delete[] d_all_fft_codes_;
|
||||
}
|
||||
GalileoE1PcpsAmbiguousAcquisitionFpga::~GalileoE1PcpsAmbiguousAcquisitionFpga() = default;
|
||||
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisitionFpga::stop_acquisition()
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <cstddef> // for size_t
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Gnss_Synchro;
|
||||
class ConfigurationInterface;
|
||||
@@ -97,8 +99,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
@@ -165,8 +167,7 @@ private:
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_ */
|
||||
|
||||
@@ -86,8 +86,8 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
|
||||
|
||||
int samples_per_ms = code_length_ / 4;
|
||||
|
||||
code_data_ = new gr_complex[vector_length_];
|
||||
code_pilot_ = new gr_complex[vector_length_];
|
||||
code_data_ = std::vector<std::complex<float>>(vector_length_);
|
||||
code_pilot_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -111,7 +111,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -123,11 +123,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsCccwsrAmbiguousAcquisition::~GalileoE1PcpsCccwsrAmbiguousAcquisition()
|
||||
{
|
||||
delete[] code_data_;
|
||||
delete[] code_pilot_;
|
||||
}
|
||||
GalileoE1PcpsCccwsrAmbiguousAcquisition::~GalileoE1PcpsCccwsrAmbiguousAcquisition() = default;
|
||||
|
||||
|
||||
void GalileoE1PcpsCccwsrAmbiguousAcquisition::stop_acquisition()
|
||||
@@ -168,6 +164,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_doppler_step(unsigned int dopp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_gnss_synchro(
|
||||
Gnss_Synchro* gnss_synchro)
|
||||
{
|
||||
@@ -203,19 +200,17 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_local_code()
|
||||
bool cboc = configuration_->property(
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
char signal[3];
|
||||
std::array<char, 3> signal = {{'1', 'B', '\0'}};
|
||||
|
||||
strcpy(signal, "1B");
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(code_data_, signal,
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<gr_complex>(code_data_.data(), vector_length_), signal,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
strcpy(signal, "1C");
|
||||
std::array<char, 3> signal_C = {{'1', 'C', '\0'}};
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(code_pilot_, signal,
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<gr_complex>(code_pilot_.data(), vector_length_), signal_C,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
acquisition_cc_->set_local_code(code_data_, code_pilot_);
|
||||
acquisition_cc_->set_local_code(code_data_.data(), code_pilot_.data());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,6 +223,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisition::reset()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1PcpsCccwsrAmbiguousAcquisition::set_state(int state)
|
||||
{
|
||||
acquisition_cc_->set_state(state);
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_cccwsr_acquisition_cc.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -94,13 +96,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_cc_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of CCCWSR algorithm
|
||||
*/
|
||||
@@ -153,7 +156,6 @@ private:
|
||||
std::string item_type_;
|
||||
unsigned int vector_length_;
|
||||
unsigned int code_length_;
|
||||
//unsigned int satellite_;
|
||||
unsigned int channel_;
|
||||
std::weak_ptr<ChannelFsm> channel_fsm_;
|
||||
float threshold_;
|
||||
@@ -164,8 +166,8 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_data_;
|
||||
std::complex<float>* code_pilot_;
|
||||
std::vector<std::complex<float>> code_data_;
|
||||
std::vector<std::complex<float>> code_pilot_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcquisition(
|
||||
@@ -114,7 +115,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
|
||||
dump_filename_ = configuration_->property(role + ".dump_filename",
|
||||
default_dump_filename);
|
||||
|
||||
code_ = new gr_complex[code_length_];
|
||||
code_ = std::vector<std::complex<float>>(code_length_);
|
||||
LOG(INFO) << "Vector Length: " << vector_length_
|
||||
<< ", Samples per ms: " << samples_per_ms
|
||||
<< ", Folding factor: " << folding_factor_
|
||||
@@ -144,7 +145,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -156,10 +157,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisition::~GalileoE1PcpsQuickSyncAmbiguousAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GalileoE1PcpsQuickSyncAmbiguousAcquisition::~GalileoE1PcpsQuickSyncAmbiguousAcquisition() = default;
|
||||
|
||||
|
||||
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::stop_acquisition()
|
||||
@@ -250,23 +248,20 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
|
||||
bool cboc = configuration_->property(
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < (sampled_ms_ / (folding_factor_ * 4)); i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
// memcpy(code_, code,sizeof(gr_complex)*code_length_);
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
|
||||
delete[] code;
|
||||
code = nullptr;
|
||||
acquisition_cc_->set_local_code(code_.data());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +274,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::reset()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_state(int state)
|
||||
{
|
||||
if (item_type_ == "gr_complex")
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_quicksync_acquisition_cc.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -169,7 +171,7 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
|
||||
@@ -89,7 +90,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
|
||||
|
||||
int samples_per_ms = code_length_ / 4;
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -114,7 +115,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -126,10 +127,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GalileoE1PcpsTongAmbiguousAcquisition::~GalileoE1PcpsTongAmbiguousAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GalileoE1PcpsTongAmbiguousAcquisition::~GalileoE1PcpsTongAmbiguousAcquisition() = default;
|
||||
|
||||
|
||||
void GalileoE1PcpsTongAmbiguousAcquisition::stop_acquisition()
|
||||
@@ -220,20 +218,19 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
|
||||
bool cboc = configuration_->property(
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(code, gnss_synchro_->Signal,
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_ / 4; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
|
||||
delete[] code;
|
||||
acquisition_cc_->set_local_code(code_.data());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +243,7 @@ void GalileoE1PcpsTongAmbiguousAcquisition::reset()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1PcpsTongAmbiguousAcquisition::set_state(int state)
|
||||
{
|
||||
acquisition_cc_->set_state(state);
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_tong_acquisition_cc.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -168,7 +170,7 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
|
||||
@@ -93,8 +94,8 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
|
||||
|
||||
vector_length_ = code_length_ * sampled_ms_;
|
||||
|
||||
codeI_ = new gr_complex[vector_length_];
|
||||
codeQ_ = new gr_complex[vector_length_];
|
||||
codeI_ = std::vector<std::complex<float>>(vector_length_);
|
||||
codeQ_ = std::vector<std::complex<float>>(vector_length_);
|
||||
both_signal_components = false;
|
||||
|
||||
std::string sig_ = configuration_->property("Channel.signal", std::string("5X"));
|
||||
@@ -119,7 +120,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -131,11 +132,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
|
||||
}
|
||||
|
||||
|
||||
GalileoE5aNoncoherentIQAcquisitionCaf::~GalileoE5aNoncoherentIQAcquisitionCaf()
|
||||
{
|
||||
delete[] codeI_;
|
||||
delete[] codeQ_;
|
||||
}
|
||||
GalileoE5aNoncoherentIQAcquisitionCaf::~GalileoE5aNoncoherentIQAcquisitionCaf() = default;
|
||||
|
||||
|
||||
void GalileoE5aNoncoherentIQAcquisitionCaf::stop_acquisition()
|
||||
@@ -223,55 +220,51 @@ void GalileoE5aNoncoherentIQAcquisitionCaf::set_local_code()
|
||||
{
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
auto* codeI = new std::complex<float>[code_length_];
|
||||
auto* codeQ = new std::complex<float>[code_length_];
|
||||
std::vector<std::complex<float>> codeI(code_length_);
|
||||
std::vector<std::complex<float>> codeQ(code_length_);
|
||||
|
||||
if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X')
|
||||
{
|
||||
char a[3];
|
||||
strcpy(a, "5I");
|
||||
galileo_e5_a_code_gen_complex_sampled(codeI, a,
|
||||
std::array<char, 3> a = {{'5', 'I', '\0'}};
|
||||
galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>>(codeI.data(), code_length_), a,
|
||||
gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
strcpy(a, "5Q");
|
||||
galileo_e5_a_code_gen_complex_sampled(codeQ, a,
|
||||
std::array<char, 3> b = {{'5', 'Q', '\0'}};
|
||||
galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>>(codeQ.data(), code_length_), b,
|
||||
gnss_synchro_->PRN, fs_in_, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
galileo_e5_a_code_gen_complex_sampled(codeI, gnss_synchro_->Signal,
|
||||
std::array<char, 3> signal_type_ = {{'5', 'X', '\0'}};
|
||||
galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>>(codeI.data(), code_length_), signal_type_,
|
||||
gnss_synchro_->PRN, fs_in_, 0);
|
||||
}
|
||||
// WARNING: 3ms are coherently integrated. Secondary sequence (1,1,1)
|
||||
// is generated, and modulated in the 'block'.
|
||||
gsl::span<gr_complex> codeQ_span(codeQ_.data(), vector_length_);
|
||||
gsl::span<gr_complex> codeI_span(codeI_.data(), vector_length_);
|
||||
if (Zero_padding == 0) // if no zero_padding
|
||||
{
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(codeI_[i * code_length_]), codeI,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(codeI.data(), code_length_, codeI_span.subspan(i * code_length_, code_length_).data());
|
||||
if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X')
|
||||
{
|
||||
memcpy(&(codeQ_[i * code_length_]), codeQ,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(codeQ.data(), code_length_, codeQ_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 1ms code + 1ms zero padding
|
||||
memcpy(&(codeI_[0]), codeI,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(codeI.data(), code_length_, codeI_.data());
|
||||
if (gnss_synchro_->Signal[0] == '5' && gnss_synchro_->Signal[1] == 'X')
|
||||
{
|
||||
memcpy(&(codeQ_[0]), codeQ,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(codeQ.data(), code_length_, codeQ_.data());
|
||||
}
|
||||
}
|
||||
|
||||
acquisition_cc_->set_local_code(codeI_, codeQ_);
|
||||
delete[] codeI;
|
||||
delete[] codeQ;
|
||||
acquisition_cc_->set_local_code(codeI_.data(), codeQ_.data());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -95,13 +97,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_cc_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -171,8 +174,8 @@ private:
|
||||
std::string dump_filename_;
|
||||
int Zero_padding;
|
||||
int CAF_window_hz_;
|
||||
std::complex<float>* codeI_;
|
||||
std::complex<float>* codeQ_;
|
||||
std::vector<std::complex<float>> codeI_;
|
||||
std::vector<std::complex<float>> codeQ_;
|
||||
bool both_signal_components;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr_complex.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration,
|
||||
@@ -123,7 +124,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
||||
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / GALILEO_E5A_CODE_CHIP_RATE_HZ * static_cast<double>(GALILEO_E5A_CODE_LENGTH_CHIPS)));
|
||||
vector_length_ = code_length_ * sampled_ms_;
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -152,7 +153,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -164,10 +165,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con
|
||||
}
|
||||
|
||||
|
||||
GalileoE5aPcpsAcquisition::~GalileoE5aPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GalileoE5aPcpsAcquisition::~GalileoE5aPcpsAcquisition() = default;
|
||||
|
||||
|
||||
void GalileoE5aPcpsAcquisition::stop_acquisition()
|
||||
@@ -235,38 +233,39 @@ void GalileoE5aPcpsAcquisition::init()
|
||||
|
||||
void GalileoE5aPcpsAcquisition::set_local_code()
|
||||
{
|
||||
auto* code = new gr_complex[code_length_];
|
||||
char signal_[3];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> signal_;
|
||||
signal_[0] = '5';
|
||||
signal_[2] = '\0';
|
||||
|
||||
if (acq_iq_)
|
||||
{
|
||||
strcpy(signal_, "5X");
|
||||
signal_[1] = 'X';
|
||||
}
|
||||
else if (acq_pilot_)
|
||||
{
|
||||
strcpy(signal_, "5Q");
|
||||
signal_[1] = 'Q';
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(signal_, "5I");
|
||||
signal_[1] = 'I';
|
||||
}
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
|
||||
galileo_e5_a_code_gen_complex_sampled(gsl::span<gr_complex>(code.get(), code_length_), signal_, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
galileo_e5_a_code_gen_complex_sampled(code, signal_, gnss_synchro_->PRN, fs_in_, 0);
|
||||
galileo_e5_a_code_gen_complex_sampled(gsl::span<gr_complex>(code.get(), code_length_), signal_, gnss_synchro_->PRN, fs_in_, 0);
|
||||
}
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(code_ + (i * code_length_), code, sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -86,13 +88,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -143,29 +146,23 @@ public:
|
||||
/*!
|
||||
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
|
||||
*/
|
||||
|
||||
void set_resampler_latency(uint32_t latency_samples) override;
|
||||
|
||||
private:
|
||||
float calculate_threshold(float pfa);
|
||||
|
||||
ConfigurationInterface* configuration_;
|
||||
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
Acq_Conf acq_parameters_;
|
||||
size_t item_size_;
|
||||
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
|
||||
bool bit_transition_flag_;
|
||||
bool dump_;
|
||||
bool acq_pilot_;
|
||||
bool use_CFAR_;
|
||||
bool blocking_;
|
||||
bool acq_iq_;
|
||||
|
||||
unsigned int vector_length_;
|
||||
unsigned int code_length_;
|
||||
unsigned int channel_;
|
||||
@@ -176,18 +173,10 @@ private:
|
||||
unsigned int max_dwells_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
int64_t fs_in_;
|
||||
|
||||
float threshold_;
|
||||
|
||||
/*
|
||||
std::complex<float>* codeI_;
|
||||
std::complex<float>* codeQ_;
|
||||
*/
|
||||
|
||||
gr_complex* code_;
|
||||
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
};
|
||||
|
||||
#endif /* GALILEO_E5A_PCPS_ACQUISITION_H_ */
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
#include <cstring> // for strcpy, memcpy
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
|
||||
// the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA
|
||||
// expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking.
|
||||
@@ -109,32 +109,34 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
|
||||
|
||||
// compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
|
||||
// a channel is assigned)
|
||||
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
|
||||
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
|
||||
std::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
|
||||
for (uint32_t PRN = 1; PRN <= GALILEO_E5A_NUMBER_OF_CODES; PRN++)
|
||||
{
|
||||
char signal_[3];
|
||||
std::array<char, 3> signal_;
|
||||
signal_[0] = '5';
|
||||
signal_[2] = '\0';
|
||||
|
||||
if (acq_iq_)
|
||||
{
|
||||
strcpy(signal_, "5X");
|
||||
signal_[1] = 'X';
|
||||
}
|
||||
else if (acq_pilot_)
|
||||
{
|
||||
strcpy(signal_, "5Q");
|
||||
signal_[1] = 'Q';
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(signal_, "5I");
|
||||
signal_[1] = 'I';
|
||||
}
|
||||
|
||||
galileo_e5_a_code_gen_complex_sampled(code, signal_, PRN, fs_in, 0);
|
||||
galileo_e5_a_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), signal_, PRN, fs_in, 0);
|
||||
|
||||
for (uint32_t s = code_length; s < 2 * code_length; s++)
|
||||
{
|
||||
@@ -147,7 +149,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
|
||||
code[s] = std::complex<float>(0.0, 0.0);
|
||||
}
|
||||
|
||||
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer
|
||||
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
|
||||
fft_if->execute(); // Run the FFT of local code
|
||||
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
|
||||
|
||||
@@ -175,7 +177,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
|
||||
}
|
||||
}
|
||||
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_;
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
|
||||
|
||||
// reference for the FPGA FFT-IFFT attenuation factor
|
||||
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
|
||||
@@ -190,17 +192,12 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
// temporary buffers that we can delete
|
||||
delete[] code;
|
||||
delete fft_if;
|
||||
delete[] fft_codes_padded;
|
||||
// temporary buffers that we can release
|
||||
volk_gnsssdr_free(fft_codes_padded);
|
||||
}
|
||||
|
||||
|
||||
GalileoE5aPcpsAcquisitionFpga::~GalileoE5aPcpsAcquisitionFpga()
|
||||
{
|
||||
delete[] d_all_fft_codes_;
|
||||
}
|
||||
GalileoE5aPcpsAcquisitionFpga::~GalileoE5aPcpsAcquisitionFpga() = default;
|
||||
|
||||
|
||||
void GalileoE5aPcpsAcquisitionFpga::stop_acquisition()
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <cstddef> // for size_t
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Gnss_Synchro;
|
||||
class ConfigurationInterface;
|
||||
@@ -99,8 +101,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
@@ -167,24 +169,19 @@ public:
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_acquisition_fpga_sptr acquisition_fpga_;
|
||||
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
|
||||
bool acq_pilot_;
|
||||
bool acq_iq_;
|
||||
|
||||
uint32_t channel_;
|
||||
std::weak_ptr<ChannelFsm> channel_fsm_;
|
||||
uint32_t doppler_max_;
|
||||
uint32_t doppler_step_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GALILEO_E5A_PCPS_ACQUISITION_FPGA_H_ */
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
@@ -93,7 +94,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
vector_length_ *= 2;
|
||||
}
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "cshort")
|
||||
{
|
||||
@@ -125,7 +126,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -137,16 +138,14 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GlonassL1CaPcpsAcquisition::~GlonassL1CaPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GlonassL1CaPcpsAcquisition::~GlonassL1CaPcpsAcquisition() = default;
|
||||
|
||||
|
||||
void GlonassL1CaPcpsAcquisition::stop_acquisition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GlonassL1CaPcpsAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
float pfa = configuration_->property(role_ + ".pfa", 0.0);
|
||||
@@ -206,18 +205,17 @@ void GlonassL1CaPcpsAcquisition::init()
|
||||
|
||||
void GlonassL1CaPcpsAcquisition::set_local_code()
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
glonass_l1_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0);
|
||||
glonass_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), /* gnss_synchro_->PRN,*/ fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -86,6 +88,7 @@ public:
|
||||
* tracking blocks
|
||||
*/
|
||||
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override;
|
||||
|
||||
/*!
|
||||
* \brief Set acquisition channel unique ID
|
||||
*/
|
||||
@@ -96,13 +99,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -172,12 +176,11 @@ private:
|
||||
bool dump_;
|
||||
bool blocking_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
@@ -92,7 +93,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
vector_length_ *= 2;
|
||||
}
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "cshort")
|
||||
{
|
||||
@@ -124,7 +125,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -136,10 +137,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GlonassL2CaPcpsAcquisition::~GlonassL2CaPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GlonassL2CaPcpsAcquisition::~GlonassL2CaPcpsAcquisition() = default;
|
||||
|
||||
|
||||
void GlonassL2CaPcpsAcquisition::stop_acquisition()
|
||||
@@ -206,18 +204,17 @@ void GlonassL2CaPcpsAcquisition::init()
|
||||
|
||||
void GlonassL2CaPcpsAcquisition::set_local_code()
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
glonass_l2_ca_code_gen_complex_sampled(code, /* gnss_synchro_->PRN,*/ fs_in_, 0);
|
||||
glonass_l2_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), /* gnss_synchro_->PRN,*/ fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -96,13 +98,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -172,12 +175,11 @@ private:
|
||||
bool dump_;
|
||||
bool blocking_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
#include <gsl/gsl>
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
@@ -121,7 +123,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
|
||||
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L1_CA_CODE_PERIOD * 1000.0);
|
||||
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "cshort")
|
||||
{
|
||||
@@ -147,7 +149,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -159,16 +161,14 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GpsL1CaPcpsAcquisition::~GpsL1CaPcpsAcquisition() = default;
|
||||
|
||||
|
||||
void GpsL1CaPcpsAcquisition::stop_acquisition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaPcpsAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
float pfa = configuration_->property(role_ + ".pfa", 0.0);
|
||||
@@ -226,24 +226,23 @@ void GpsL1CaPcpsAcquisition::init()
|
||||
|
||||
void GpsL1CaPcpsAcquisition::set_local_code()
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, acq_parameters_.resampled_fs, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
|
||||
}
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,9 @@
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -102,13 +104,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -157,10 +160,8 @@ public:
|
||||
/*!
|
||||
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
|
||||
*/
|
||||
|
||||
void set_resampler_latency(uint32_t latency_samples) override;
|
||||
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
@@ -184,12 +185,11 @@ private:
|
||||
bool dump_;
|
||||
bool blocking_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
|
||||
//--- Find number of samples per spreading code -------------------------
|
||||
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
acq_parameters.samples_per_ms = vector_length_;
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -97,7 +97,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -109,10 +109,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler(
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionFineDoppler::~GpsL1CaPcpsAcquisitionFineDoppler()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GpsL1CaPcpsAcquisitionFineDoppler::~GpsL1CaPcpsAcquisitionFineDoppler() = default;
|
||||
|
||||
|
||||
void GpsL1CaPcpsAcquisitionFineDoppler::stop_acquisition()
|
||||
@@ -163,8 +160,8 @@ void GpsL1CaPcpsAcquisitionFineDoppler::init()
|
||||
|
||||
void GpsL1CaPcpsAcquisitionFineDoppler::set_local_code()
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0);
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code_.data(), vector_length_), gnss_synchro_->PRN, fs_in_, 0);
|
||||
acquisition_cc_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_acquisition_fine_doppler_cc.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -95,13 +97,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_cc_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -161,7 +164,7 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
#include <cstring> // for memcpy
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
|
||||
#define NUM_PRNs 32
|
||||
|
||||
@@ -103,17 +103,17 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
|
||||
// compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
|
||||
// a channel is assigned)
|
||||
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
|
||||
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));
|
||||
// allocate memory to compute all the PRNs and compute all the possible codes
|
||||
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||
std::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
float max;
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
// temporary maxima search
|
||||
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), PRN, fs_in, 0); // generate PRN code
|
||||
|
||||
for (uint32_t s = code_length; s < 2 * code_length; s++)
|
||||
{
|
||||
@@ -126,7 +126,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
code[s] = std::complex<float>(0.0, 0.0);
|
||||
}
|
||||
|
||||
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer
|
||||
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
|
||||
fft_if->execute(); // Run the FFT of local code
|
||||
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
|
||||
|
||||
@@ -154,8 +154,8 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
}
|
||||
}
|
||||
|
||||
//acq_parameters
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_;
|
||||
// acq_parameters
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
|
||||
|
||||
// reference for the FPGA FFT-IFFT attenuation factor
|
||||
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 10);
|
||||
@@ -169,18 +169,13 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
||||
channel_ = 0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
// temporary buffers that we can delete
|
||||
delete[] code;
|
||||
delete fft_if;
|
||||
delete[] fft_codes_padded;
|
||||
|
||||
// temporary buffers that we can release
|
||||
volk_gnsssdr_free(fft_codes_padded);
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAcquisitionFpga::~GpsL1CaPcpsAcquisitionFpga()
|
||||
{
|
||||
delete[] d_all_fft_codes_;
|
||||
}
|
||||
GpsL1CaPcpsAcquisitionFpga::~GpsL1CaPcpsAcquisitionFpga() = default;
|
||||
|
||||
|
||||
void GpsL1CaPcpsAcquisitionFpga::stop_acquisition()
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <cstddef> // for size_t
|
||||
#include <string> // for string
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Gnss_Synchro;
|
||||
class ConfigurationInterface;
|
||||
@@ -167,7 +169,7 @@ private:
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_ */
|
||||
|
||||
@@ -70,7 +70,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
|
||||
//--- Find number of samples per spreading code -------------------------
|
||||
vector_length_ = round(fs_in_ / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::make_shared<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -89,7 +89,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -101,10 +101,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsAssistedAcquisition::~GpsL1CaPcpsAssistedAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GpsL1CaPcpsAssistedAcquisition::~GpsL1CaPcpsAssistedAcquisition() = default;
|
||||
|
||||
|
||||
void GpsL1CaPcpsAssistedAcquisition::stop_acquisition()
|
||||
@@ -154,8 +151,8 @@ void GpsL1CaPcpsAssistedAcquisition::init()
|
||||
|
||||
void GpsL1CaPcpsAssistedAcquisition::set_local_code()
|
||||
{
|
||||
gps_l1_ca_code_gen_complex_sampled(code_, gnss_synchro_->PRN, fs_in_, 0);
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<gr_complex>(code_.get(), vector_length_), gnss_synchro_->PRN, fs_in_, 0);
|
||||
acquisition_cc_->set_local_code(code_.get());
|
||||
}
|
||||
|
||||
void GpsL1CaPcpsAssistedAcquisition::reset()
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_assisted_acquisition_cc.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -95,13 +97,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_cc_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -147,7 +150,6 @@ private:
|
||||
size_t item_size_;
|
||||
std::string item_type_;
|
||||
unsigned int vector_length_;
|
||||
//unsigned int satellite_;
|
||||
unsigned int channel_;
|
||||
std::weak_ptr<ChannelFsm> channel_fsm_;
|
||||
float threshold_;
|
||||
@@ -159,7 +161,7 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::shared_ptr<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
|
||||
@@ -59,7 +60,10 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
|
||||
fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
dump_ = configuration_->property(role + ".dump", false);
|
||||
doppler_max_ = configuration->property(role + ".doppler_max", 5000);
|
||||
if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max;
|
||||
if (FLAGS_doppler_max != 0)
|
||||
{
|
||||
doppler_max_ = FLAGS_doppler_max;
|
||||
}
|
||||
sampled_ms_ = configuration_->property(role + ".coherent_integration_time_ms", 1);
|
||||
|
||||
bit_transition_flag_ = configuration_->property("Acquisition.bit_transition_flag", false);
|
||||
@@ -81,7 +85,7 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
|
||||
|
||||
vector_length_ = code_length_ * sampled_ms_;
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -105,7 +109,7 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -117,16 +121,14 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsOpenClAcquisition::~GpsL1CaPcpsOpenClAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GpsL1CaPcpsOpenClAcquisition::~GpsL1CaPcpsOpenClAcquisition() = default;
|
||||
|
||||
|
||||
void GpsL1CaPcpsOpenClAcquisition::stop_acquisition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaPcpsOpenClAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
|
||||
@@ -207,19 +209,17 @@ void GpsL1CaPcpsOpenClAcquisition::set_local_code()
|
||||
{
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
|
||||
delete[] code;
|
||||
acquisition_cc_->set_local_code(code_.data());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_opencl_acquisition_cc.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -94,13 +96,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_cc_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -144,6 +147,12 @@ public:
|
||||
|
||||
void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{};
|
||||
|
||||
inline bool opencl_ready() const
|
||||
{
|
||||
bool ready = this->acquisition_cc_->opencl_ready();
|
||||
return ready;
|
||||
}
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_opencl_acquisition_cc_sptr acquisition_cc_;
|
||||
@@ -163,12 +172,11 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
|
||||
@@ -104,7 +105,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
|
||||
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
|
||||
|
||||
int samples_per_ms = round(code_length_);
|
||||
code_ = new gr_complex[code_length_]();
|
||||
code_ = std::vector<std::complex<float>>(code_length_);
|
||||
/*Object relevant information for debugging*/
|
||||
LOG(INFO) << "Implementation: " << this->implementation()
|
||||
<< ", Vector Length: " << vector_length_
|
||||
@@ -137,7 +138,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -149,16 +150,14 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsQuickSyncAcquisition::~GpsL1CaPcpsQuickSyncAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GpsL1CaPcpsQuickSyncAcquisition::~GpsL1CaPcpsQuickSyncAcquisition() = default;
|
||||
|
||||
|
||||
void GpsL1CaPcpsQuickSyncAcquisition::stop_acquisition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaPcpsQuickSyncAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
|
||||
@@ -236,20 +235,17 @@ void GpsL1CaPcpsQuickSyncAcquisition::set_local_code()
|
||||
{
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_]();
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < (sampled_ms_ / folding_factor_); i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
//memcpy(code_, code,sizeof(gr_complex)*code_length_);
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
|
||||
delete[] code;
|
||||
acquisition_cc_->set_local_code(code_.data());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_quicksync_acquisition_cc.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -96,13 +98,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_cc_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -170,12 +173,11 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "gps_sdr_signal_processing.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
|
||||
@@ -75,7 +76,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
|
||||
|
||||
vector_length_ = code_length_ * sampled_ms_;
|
||||
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
@@ -99,7 +100,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -111,16 +112,14 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GpsL1CaPcpsTongAcquisition::~GpsL1CaPcpsTongAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GpsL1CaPcpsTongAcquisition::~GpsL1CaPcpsTongAcquisition() = default;
|
||||
|
||||
|
||||
void GpsL1CaPcpsTongAcquisition::stop_acquisition()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaPcpsTongAcquisition::set_threshold(float threshold)
|
||||
{
|
||||
float pfa = configuration_->property(role_ + std::to_string(channel_) + ".pfa", 0.0);
|
||||
@@ -193,23 +192,22 @@ void GpsL1CaPcpsTongAcquisition::init()
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
void GpsL1CaPcpsTongAcquisition::set_local_code()
|
||||
{
|
||||
if (item_type_ == "gr_complex")
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
gps_l1_ca_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), gnss_synchro_->PRN, fs_in_, 0);
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < sampled_ms_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_cc_->set_local_code(code_);
|
||||
|
||||
delete[] code;
|
||||
acquisition_cc_->set_local_code(code_.data());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,9 @@
|
||||
#include "gnss_synchro.h"
|
||||
#include "pcps_tong_acquisition_cc.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
@@ -95,13 +97,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_cc_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of TONG algorithm
|
||||
*/
|
||||
@@ -169,12 +172,11 @@ private:
|
||||
int64_t fs_in_;
|
||||
bool dump_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "gps_l2c_signal.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
@@ -126,7 +127,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
|
||||
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L2_M_PERIOD * 1000.0);
|
||||
vector_length_ = acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms * (acq_parameters_.bit_transition_flag ? 2 : 1);
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
|
||||
if (item_type_ == "cshort")
|
||||
{
|
||||
@@ -151,7 +152,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
num_codes_ = acq_parameters_.sampled_ms / acq_parameters_.ms_per_code;
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
@@ -164,10 +165,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GpsL2MPcpsAcquisition::~GpsL2MPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GpsL2MPcpsAcquisition::~GpsL2MPcpsAcquisition() = default;
|
||||
|
||||
|
||||
void GpsL2MPcpsAcquisition::stop_acquisition()
|
||||
@@ -239,27 +237,24 @@ void GpsL2MPcpsAcquisition::init()
|
||||
|
||||
void GpsL2MPcpsAcquisition::set_local_code()
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs);
|
||||
gps_l2c_m_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), gnss_synchro_->PRN, acq_parameters_.resampled_fs);
|
||||
}
|
||||
else
|
||||
{
|
||||
gps_l2c_m_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
|
||||
gps_l2c_m_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), gnss_synchro_->PRN, fs_in_);
|
||||
}
|
||||
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < num_codes_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
@@ -268,6 +263,7 @@ void GpsL2MPcpsAcquisition::reset()
|
||||
acquisition_->set_active(true);
|
||||
}
|
||||
|
||||
|
||||
void GpsL2MPcpsAcquisition::set_state(int state)
|
||||
{
|
||||
acquisition_->set_state(state);
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -99,13 +101,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -154,10 +157,8 @@ public:
|
||||
/*!
|
||||
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
|
||||
*/
|
||||
|
||||
void set_resampler_latency(uint32_t latency_samples) override;
|
||||
|
||||
|
||||
private:
|
||||
ConfigurationInterface* configuration_;
|
||||
pcps_acquisition_sptr acquisition_;
|
||||
@@ -180,13 +181,12 @@ private:
|
||||
bool dump_;
|
||||
bool blocking_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
unsigned int num_codes_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
#include <cstring> // for memcpy
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
|
||||
#define NUM_PRNs 32
|
||||
#define QUANT_BITS_LOCAL_CODE 16
|
||||
@@ -102,24 +102,24 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
|
||||
|
||||
// compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
|
||||
// a channel is assigned)
|
||||
auto* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT
|
||||
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
|
||||
// allocate memory to compute all the PRNs and compute all the possible codes
|
||||
auto* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||
std::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
//d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
float max; // temporary maxima search
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
|
||||
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
{
|
||||
gps_l2c_m_code_gen_complex_sampled(code, PRN, fs_in_);
|
||||
gps_l2c_m_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.data(), nsamples_total), PRN, fs_in_);
|
||||
// fill in zero padding
|
||||
for (unsigned int s = code_length; s < nsamples_total; s++)
|
||||
{
|
||||
code[s] = std::complex<float>(0.0, 0.0);
|
||||
}
|
||||
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer
|
||||
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
|
||||
fft_if->execute(); // Run the FFT of local code
|
||||
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
|
||||
max = 0; // initialize maximum value
|
||||
@@ -149,28 +149,22 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
|
||||
}
|
||||
}
|
||||
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_;
|
||||
|
||||
// temporary buffers that we can delete
|
||||
delete[] code;
|
||||
delete fft_if;
|
||||
delete[] fft_codes_padded;
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
|
||||
|
||||
acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters);
|
||||
|
||||
channel_ = 0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
threshold_ = 0.0;
|
||||
|
||||
// temporary buffers that we can release
|
||||
volk_gnsssdr_free(fft_codes_padded);
|
||||
}
|
||||
|
||||
|
||||
GpsL2MPcpsAcquisitionFpga::~GpsL2MPcpsAcquisitionFpga()
|
||||
{
|
||||
delete[] d_all_fft_codes_;
|
||||
}
|
||||
GpsL2MPcpsAcquisitionFpga::~GpsL2MPcpsAcquisitionFpga() = default;
|
||||
|
||||
|
||||
void GpsL2MPcpsAcquisitionFpga::stop_acquisition()
|
||||
|
||||
@@ -39,7 +39,9 @@
|
||||
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <cstddef> // for size_t
|
||||
#include <memory> // for weak_ptr
|
||||
#include <string> // for string
|
||||
#include <vector>
|
||||
|
||||
class Gnss_Synchro;
|
||||
class ConfigurationInterface;
|
||||
@@ -98,8 +100,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
@@ -168,10 +170,7 @@ private:
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
|
||||
//float calculate_threshold(float pfa);
|
||||
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H_ */
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "gps_l5_signal.h"
|
||||
#include <boost/math/distributions/exponential.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
@@ -133,7 +134,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
|
||||
acq_parameters_.samples_per_code = acq_parameters_.samples_per_ms * static_cast<float>(GPS_L5I_PERIOD * 1000.0);
|
||||
vector_length_ = std::floor(acq_parameters_.sampled_ms * acq_parameters_.samples_per_ms) * (acq_parameters_.bit_transition_flag ? 2 : 1);
|
||||
code_ = new gr_complex[vector_length_];
|
||||
code_ = std::vector<std::complex<float>>(vector_length_);
|
||||
acquisition_ = pcps_make_acquisition(acq_parameters_);
|
||||
DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")";
|
||||
|
||||
@@ -147,7 +148,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
threshold_ = 0.0;
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
|
||||
if (in_streams_ > 1)
|
||||
{
|
||||
LOG(ERROR) << "This implementation only supports one input stream";
|
||||
@@ -159,10 +160,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition(
|
||||
}
|
||||
|
||||
|
||||
GpsL5iPcpsAcquisition::~GpsL5iPcpsAcquisition()
|
||||
{
|
||||
delete[] code_;
|
||||
}
|
||||
GpsL5iPcpsAcquisition::~GpsL5iPcpsAcquisition() = default;
|
||||
|
||||
|
||||
void GpsL5iPcpsAcquisition::stop_acquisition()
|
||||
@@ -230,28 +228,27 @@ void GpsL5iPcpsAcquisition::init()
|
||||
acquisition_->init();
|
||||
}
|
||||
|
||||
|
||||
void GpsL5iPcpsAcquisition::set_local_code()
|
||||
{
|
||||
auto* code = new std::complex<float>[code_length_];
|
||||
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, acq_parameters_.resampled_fs);
|
||||
gps_l5i_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), gnss_synchro_->PRN, acq_parameters_.resampled_fs);
|
||||
}
|
||||
else
|
||||
{
|
||||
gps_l5i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_);
|
||||
gps_l5i_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), gnss_synchro_->PRN, fs_in_);
|
||||
}
|
||||
|
||||
gsl::span<gr_complex> code_span(code_.data(), vector_length_);
|
||||
for (unsigned int i = 0; i < num_codes_; i++)
|
||||
{
|
||||
memcpy(&(code_[i * code_length_]), code,
|
||||
sizeof(gr_complex) * code_length_);
|
||||
std::copy_n(code.get(), code_length_, code_span.subspan(i * code_length_, code_length_).data());
|
||||
}
|
||||
|
||||
acquisition_->set_local_code(code_);
|
||||
delete[] code;
|
||||
acquisition_->set_local_code(code_.data());
|
||||
}
|
||||
|
||||
|
||||
@@ -260,6 +257,7 @@ void GpsL5iPcpsAcquisition::reset()
|
||||
acquisition_->set_active(true);
|
||||
}
|
||||
|
||||
|
||||
void GpsL5iPcpsAcquisition::set_state(int state)
|
||||
{
|
||||
acquisition_->set_state(state);
|
||||
@@ -359,6 +357,7 @@ gr::basic_block_sptr GpsL5iPcpsAcquisition::get_right_block()
|
||||
return acquisition_;
|
||||
}
|
||||
|
||||
|
||||
void GpsL5iPcpsAcquisition::set_resampler_latency(uint32_t latency_samples)
|
||||
{
|
||||
acquisition_->set_resampler_latency(latency_samples);
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_GPS_L5i_PCPS_ACQUISITION_H_
|
||||
#define GNSS_SDR_GPS_L5i_PCPS_ACQUISITION_H_
|
||||
#ifndef GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_H_
|
||||
#define GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_H_
|
||||
|
||||
#include "channel_fsm.h"
|
||||
#include "complex_byte_to_float_x2.h"
|
||||
@@ -40,7 +40,9 @@
|
||||
#include "pcps_acquisition.h"
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
@@ -99,13 +101,14 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
acquisition_->set_channel_fsm(channel_fsm);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm
|
||||
*/
|
||||
@@ -154,7 +157,6 @@ public:
|
||||
/*!
|
||||
* \brief Sets the resampler latency to account it in the acquisition code delay estimation
|
||||
*/
|
||||
|
||||
void set_resampler_latency(uint32_t latency_samples) override;
|
||||
|
||||
private:
|
||||
@@ -179,14 +181,13 @@ private:
|
||||
bool dump_;
|
||||
bool blocking_;
|
||||
std::string dump_filename_;
|
||||
std::complex<float>* code_;
|
||||
std::vector<std::complex<float>> code_;
|
||||
Gnss_Synchro* gnss_synchro_;
|
||||
std::string role_;
|
||||
unsigned int num_codes_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_GPS_L5i_PCPS_ACQUISITION_H_ */
|
||||
#endif /* GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_H_ */
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
#include <gnuradio/gr_complex.h> // for gr_complex
|
||||
#include <volk/volk.h> // for volk_32fc_conjugate_32fc
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
#include <cstring> // for memcpy
|
||||
#include <algorithm> // for copy_n
|
||||
#include <cmath> // for abs, pow, floor
|
||||
#include <complex> // for complex
|
||||
|
||||
#define NUM_PRNs 32
|
||||
|
||||
@@ -108,17 +108,17 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
|
||||
// compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
|
||||
// a channel is assigned)
|
||||
auto* fft_if = new gr::fft::fft_complex(nsamples_total, true); // Direct FFT
|
||||
auto* code = new gr_complex[nsamples_total];
|
||||
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
|
||||
std::vector<std::complex<float>> code(nsamples_total);
|
||||
auto* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_all_fft_codes_ = new uint32_t[(nsamples_total * NUM_PRNs)]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32
|
||||
|
||||
float max; // temporary maxima search
|
||||
int32_t tmp, tmp2, local_code, fft_data;
|
||||
|
||||
for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||
{
|
||||
gps_l5i_code_gen_complex_sampled(code, PRN, fs_in);
|
||||
gps_l5i_code_gen_complex_sampled(gsl::span<gr_complex>(code.data(), nsamples_total), PRN, fs_in);
|
||||
|
||||
for (uint32_t s = code_length; s < 2 * code_length; s++)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
// fill in zero padding
|
||||
code[s] = std::complex<float>(0.0, 0.0);
|
||||
}
|
||||
memcpy(fft_if->get_inbuf(), code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer
|
||||
std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer
|
||||
fft_if->execute(); // Run the FFT of local code
|
||||
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
|
||||
|
||||
@@ -158,7 +158,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
}
|
||||
}
|
||||
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_;
|
||||
acq_parameters.all_fft_codes = d_all_fft_codes_.data();
|
||||
|
||||
// reference for the FPGA FFT-IFFT attenuation factor
|
||||
acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 13);
|
||||
@@ -173,18 +173,12 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
|
||||
doppler_step_ = 0;
|
||||
gnss_synchro_ = nullptr;
|
||||
|
||||
// temporary buffers that we can delete
|
||||
delete[] code;
|
||||
delete fft_if;
|
||||
delete[] fft_codes_padded;
|
||||
// temporary buffers that we can release
|
||||
volk_gnsssdr_free(fft_codes_padded);
|
||||
}
|
||||
|
||||
|
||||
GpsL5iPcpsAcquisitionFpga::~GpsL5iPcpsAcquisitionFpga()
|
||||
{
|
||||
//delete[] code_;
|
||||
delete[] d_all_fft_codes_;
|
||||
}
|
||||
GpsL5iPcpsAcquisitionFpga::~GpsL5iPcpsAcquisitionFpga() = default;
|
||||
|
||||
|
||||
void GpsL5iPcpsAcquisitionFpga::stop_acquisition()
|
||||
|
||||
@@ -40,7 +40,9 @@
|
||||
#include <gnuradio/runtime_types.h> // for basic_block_sptr, top_block_sptr
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <cstddef> // for size_t
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class Gnss_Synchro;
|
||||
class ConfigurationInterface;
|
||||
@@ -99,8 +101,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm) override
|
||||
{
|
||||
channel_fsm_ = channel_fsm;
|
||||
@@ -167,9 +169,7 @@ private:
|
||||
std::string role_;
|
||||
unsigned int in_streams_;
|
||||
unsigned int out_streams_;
|
||||
|
||||
uint32_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||
|
||||
std::vector<uint32_t> d_all_fft_codes_; // memory that contains all the code ffts
|
||||
float calculate_threshold(float pfa);
|
||||
};
|
||||
|
||||
|
||||
@@ -49,16 +49,6 @@ if(OPENCL_FOUND)
|
||||
set(ACQ_GR_BLOCKS_HEADERS ${ACQ_GR_BLOCKS_HEADERS} pcps_opencl_acquisition_cc.h)
|
||||
endif()
|
||||
|
||||
|
||||
if(OPENCL_FOUND)
|
||||
include_directories(${OPENCL_INCLUDE_DIRS})
|
||||
if(OS_IS_MACOSX)
|
||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
|
||||
else()
|
||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(SORT ACQ_GR_BLOCKS_HEADERS)
|
||||
list(SORT ACQ_GR_BLOCKS_SOURCES)
|
||||
|
||||
@@ -78,19 +68,19 @@ endif()
|
||||
|
||||
target_link_libraries(acquisition_gr_blocks
|
||||
PUBLIC
|
||||
algorithms_libs
|
||||
Gnuradio::runtime
|
||||
Gnuradio::fft
|
||||
Volk::volk
|
||||
channel_libs
|
||||
acquisition_libs
|
||||
core_system_parameters
|
||||
${OPT_LIBRARIES}
|
||||
PRIVATE
|
||||
Gflags::gflags
|
||||
Glog::glog
|
||||
Matio::matio
|
||||
Volkgnsssdr::volkgnsssdr
|
||||
algorithms_libs
|
||||
|
||||
)
|
||||
|
||||
target_include_directories(acquisition_gr_blocks
|
||||
@@ -101,7 +91,11 @@ target_include_directories(acquisition_gr_blocks
|
||||
)
|
||||
|
||||
if(OPENCL_FOUND)
|
||||
target_include_directories(acquisition_gr_blocks PUBLIC ${OPENCL_INCLUDE_DIRS})
|
||||
target_link_libraries(acquisition_gr_blocks PUBLIC OpenCL::OpenCL)
|
||||
target_include_directories(acquisition_gr_blocks
|
||||
PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_CLANG_TIDY)
|
||||
@@ -116,4 +110,5 @@ endif()
|
||||
set_property(TARGET acquisition_gr_blocks
|
||||
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/algorithms/libs/opencl>
|
||||
)
|
||||
|
||||
@@ -145,10 +145,10 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
|
||||
}
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
|
||||
// For dumping samples into a file
|
||||
d_dump = dump;
|
||||
@@ -210,9 +210,6 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::~galileo_e5a_noncoherentIQ_acquisi
|
||||
}
|
||||
}
|
||||
|
||||
delete d_fft_if;
|
||||
delete d_ifft;
|
||||
|
||||
try
|
||||
{
|
||||
if (d_dump)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <gnuradio/fft/fft.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -51,8 +52,8 @@ class galileo_e5a_noncoherentIQ_acquisition_caf_cc;
|
||||
|
||||
using galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr = boost::shared_ptr<galileo_e5a_noncoherentIQ_acquisition_caf_cc>;
|
||||
|
||||
galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr
|
||||
galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms,
|
||||
galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
|
||||
unsigned int sampled_ms,
|
||||
unsigned int max_dwells,
|
||||
unsigned int doppler_max, int64_t fs_in,
|
||||
int samples_per_ms, int samples_per_code,
|
||||
@@ -71,88 +72,6 @@ galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms,
|
||||
*/
|
||||
class galileo_e5a_noncoherentIQ_acquisition_caf_cc : public gr::block
|
||||
{
|
||||
private:
|
||||
friend galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr
|
||||
galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
|
||||
unsigned int sampled_ms,
|
||||
unsigned int max_dwells,
|
||||
unsigned int doppler_max, int64_t fs_in,
|
||||
int samples_per_ms, int samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
bool both_signal_components_,
|
||||
int CAF_window_hz_,
|
||||
int Zero_padding_);
|
||||
|
||||
galileo_e5a_noncoherentIQ_acquisition_caf_cc(
|
||||
unsigned int sampled_ms,
|
||||
unsigned int max_dwells,
|
||||
unsigned int doppler_max, int64_t fs_in,
|
||||
int samples_per_ms, int samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
bool both_signal_components_,
|
||||
int CAF_window_hz_,
|
||||
int Zero_padding_);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
||||
int doppler_offset);
|
||||
float estimate_input_power(gr_complex* in);
|
||||
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
int64_t d_fs_in;
|
||||
int d_samples_per_ms;
|
||||
int d_sampled_ms;
|
||||
int d_samples_per_code;
|
||||
unsigned int d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
unsigned int d_doppler_max;
|
||||
unsigned int d_doppler_step;
|
||||
unsigned int d_max_dwells;
|
||||
unsigned int d_well_count;
|
||||
unsigned int d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
unsigned int d_num_doppler_bins;
|
||||
gr_complex* d_fft_code_I_A;
|
||||
gr_complex* d_fft_code_I_B;
|
||||
gr_complex* d_fft_code_Q_A;
|
||||
gr_complex* d_fft_code_Q_B;
|
||||
gr_complex* d_inbuffer;
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
unsigned int d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitudeIA;
|
||||
float* d_magnitudeIB;
|
||||
float* d_magnitudeQA;
|
||||
float* d_magnitudeQB;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
bool d_bit_transition_flag;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int d_state;
|
||||
bool d_dump;
|
||||
bool d_both_signal_components;
|
||||
// bool d_CAF_filter;
|
||||
int d_CAF_window_hz;
|
||||
float* d_CAF_vector;
|
||||
float* d_CAF_vector_I;
|
||||
float* d_CAF_vector_Q;
|
||||
// double* d_CAF_vector;
|
||||
// double* d_CAF_vector_I;
|
||||
// double* d_CAF_vector_Q;
|
||||
unsigned int d_channel;
|
||||
std::string d_dump_filename;
|
||||
unsigned int d_buffer_count;
|
||||
unsigned int d_gr_stream_buffer;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
@@ -256,5 +175,85 @@ public:
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
private:
|
||||
friend galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr
|
||||
galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(
|
||||
unsigned int sampled_ms,
|
||||
unsigned int max_dwells,
|
||||
unsigned int doppler_max, int64_t fs_in,
|
||||
int samples_per_ms, int samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
bool both_signal_components_,
|
||||
int CAF_window_hz_,
|
||||
int Zero_padding_);
|
||||
|
||||
galileo_e5a_noncoherentIQ_acquisition_caf_cc(
|
||||
unsigned int sampled_ms,
|
||||
unsigned int max_dwells,
|
||||
unsigned int doppler_max, int64_t fs_in,
|
||||
int samples_per_ms, int samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename,
|
||||
bool both_signal_components_,
|
||||
int CAF_window_hz_,
|
||||
int Zero_padding_);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
|
||||
int doppler_offset);
|
||||
|
||||
float estimate_input_power(gr_complex* in);
|
||||
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
int64_t d_fs_in;
|
||||
int d_samples_per_ms;
|
||||
int d_sampled_ms;
|
||||
int d_samples_per_code;
|
||||
unsigned int d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
unsigned int d_doppler_max;
|
||||
unsigned int d_doppler_step;
|
||||
unsigned int d_max_dwells;
|
||||
unsigned int d_well_count;
|
||||
unsigned int d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
unsigned int d_num_doppler_bins;
|
||||
gr_complex* d_fft_code_I_A;
|
||||
gr_complex* d_fft_code_I_B;
|
||||
gr_complex* d_fft_code_Q_A;
|
||||
gr_complex* d_fft_code_Q_B;
|
||||
gr_complex* d_inbuffer;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
unsigned int d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitudeIA;
|
||||
float* d_magnitudeIB;
|
||||
float* d_magnitudeQA;
|
||||
float* d_magnitudeQB;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
bool d_bit_transition_flag;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int d_state;
|
||||
bool d_dump;
|
||||
bool d_both_signal_components;
|
||||
int d_CAF_window_hz;
|
||||
float* d_CAF_vector;
|
||||
float* d_CAF_vector_I;
|
||||
float* d_CAF_vector_Q;
|
||||
unsigned int d_channel;
|
||||
std::string d_dump_filename;
|
||||
unsigned int d_buffer_count;
|
||||
unsigned int d_gr_stream_buffer;
|
||||
};
|
||||
|
||||
#endif /* GALILEO_E5A_NONCOHERENT_IQ_ACQUISITION_CAF_CC_H_ */
|
||||
|
||||
@@ -87,10 +87,10 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
|
||||
d_magnitude = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
|
||||
// For dumping samples into a file
|
||||
d_dump = dump;
|
||||
@@ -123,9 +123,6 @@ galileo_pcps_8ms_acquisition_cc::~galileo_pcps_8ms_acquisition_cc()
|
||||
volk_gnsssdr_free(d_fft_code_B);
|
||||
volk_gnsssdr_free(d_magnitude);
|
||||
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
|
||||
try
|
||||
{
|
||||
if (d_dump)
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <gnuradio/fft/fft.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -61,67 +62,6 @@ galileo_pcps_8ms_make_acquisition_cc(uint32_t sampled_ms,
|
||||
*/
|
||||
class galileo_pcps_8ms_acquisition_cc : public gr::block
|
||||
{
|
||||
private:
|
||||
friend galileo_pcps_8ms_acquisition_cc_sptr
|
||||
galileo_pcps_8ms_make_acquisition_cc(
|
||||
uint32_t sampled_ms,
|
||||
uint32_t max_dwells,
|
||||
uint32_t doppler_max,
|
||||
int64_t fs_in,
|
||||
int32_t samples_per_ms,
|
||||
int32_t samples_per_code,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
galileo_pcps_8ms_acquisition_cc(
|
||||
uint32_t sampled_ms,
|
||||
uint32_t max_dwells,
|
||||
uint32_t doppler_max,
|
||||
int64_t fs_in,
|
||||
int32_t samples_per_ms,
|
||||
int32_t samples_per_code,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(
|
||||
gr_complex* fft_begin,
|
||||
int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_samples_per_code;
|
||||
uint32_t d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_max_dwells;
|
||||
uint32_t d_well_count;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_code_A;
|
||||
gr_complex* d_fft_code_B;
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitude;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int32_t d_state;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
@@ -225,6 +165,67 @@ public:
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
private:
|
||||
friend galileo_pcps_8ms_acquisition_cc_sptr
|
||||
galileo_pcps_8ms_make_acquisition_cc(
|
||||
uint32_t sampled_ms,
|
||||
uint32_t max_dwells,
|
||||
uint32_t doppler_max,
|
||||
int64_t fs_in,
|
||||
int32_t samples_per_ms,
|
||||
int32_t samples_per_code,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
galileo_pcps_8ms_acquisition_cc(
|
||||
uint32_t sampled_ms,
|
||||
uint32_t max_dwells,
|
||||
uint32_t doppler_max,
|
||||
int64_t fs_in,
|
||||
int32_t samples_per_ms,
|
||||
int32_t samples_per_code,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(
|
||||
gr_complex* fft_begin,
|
||||
int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_samples_per_code;
|
||||
uint32_t d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_max_dwells;
|
||||
uint32_t d_well_count;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_code_A;
|
||||
gr_complex* d_fft_code_B;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitude;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int32_t d_state;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_PCPS_8MS_ACQUISITION_CC_H_*/
|
||||
|
||||
@@ -134,30 +134,22 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
|
||||
acq_parameters.max_dwells = 1; // Activation of acq_parameters.bit_transition_flag invalidates the value of acq_parameters.max_dwells
|
||||
}
|
||||
|
||||
d_tmp_buffer = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_fft_codes = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_magnitude = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
d_input_signal = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_tmp_buffer = std::vector<float>(d_fft_size);
|
||||
d_fft_codes = std::vector<std::complex<float>>(d_fft_size);
|
||||
d_input_signal = std::vector<std::complex<float>>(d_fft_size);
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
|
||||
d_gnss_synchro = nullptr;
|
||||
d_grid_doppler_wipeoffs = nullptr;
|
||||
d_grid_doppler_wipeoffs_step_two = nullptr;
|
||||
d_magnitude_grid = nullptr;
|
||||
d_worker_active = false;
|
||||
d_data_buffer = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_consumed_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_data_buffer = std::vector<std::complex<float>>(d_consumed_samples);
|
||||
if (d_cshort)
|
||||
{
|
||||
d_data_buffer_sc = static_cast<lv_16sc_t*>(volk_gnsssdr_malloc(d_consumed_samples * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
|
||||
}
|
||||
else
|
||||
{
|
||||
d_data_buffer_sc = nullptr;
|
||||
d_data_buffer_sc = std::vector<lv_16sc_t>(d_consumed_samples);
|
||||
}
|
||||
grid_ = arma::fmat();
|
||||
narrow_grid_ = arma::fmat();
|
||||
@@ -213,38 +205,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
|
||||
}
|
||||
|
||||
|
||||
pcps_acquisition::~pcps_acquisition()
|
||||
{
|
||||
if (d_num_doppler_bins > 0)
|
||||
{
|
||||
for (uint32_t i = 0; i < d_num_doppler_bins; i++)
|
||||
{
|
||||
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
|
||||
volk_gnsssdr_free(d_magnitude_grid[i]);
|
||||
}
|
||||
delete[] d_grid_doppler_wipeoffs;
|
||||
delete[] d_magnitude_grid;
|
||||
}
|
||||
if (acq_parameters.make_2_steps)
|
||||
{
|
||||
for (uint32_t i = 0; i < d_num_doppler_bins_step2; i++)
|
||||
{
|
||||
volk_gnsssdr_free(d_grid_doppler_wipeoffs_step_two[i]);
|
||||
}
|
||||
delete[] d_grid_doppler_wipeoffs_step_two;
|
||||
}
|
||||
volk_gnsssdr_free(d_fft_codes);
|
||||
volk_gnsssdr_free(d_magnitude);
|
||||
volk_gnsssdr_free(d_tmp_buffer);
|
||||
volk_gnsssdr_free(d_input_signal);
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
volk_gnsssdr_free(d_data_buffer);
|
||||
if (d_cshort)
|
||||
{
|
||||
volk_gnsssdr_free(d_data_buffer_sc);
|
||||
}
|
||||
}
|
||||
pcps_acquisition::~pcps_acquisition() = default;
|
||||
|
||||
|
||||
void pcps_acquisition::set_resampler_latency(uint32_t latency_samples)
|
||||
@@ -288,7 +249,7 @@ void pcps_acquisition::set_local_code(std::complex<float>* code)
|
||||
}
|
||||
|
||||
d_fft_if->execute(); // We need the FFT of local code
|
||||
volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size);
|
||||
volk_32fc_conjugate_32fc(d_fft_codes.data(), d_fft_if->get_outbuf(), d_fft_size);
|
||||
}
|
||||
|
||||
|
||||
@@ -311,7 +272,7 @@ bool pcps_acquisition::is_fdma()
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq)
|
||||
void pcps_acquisition::update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq)
|
||||
{
|
||||
float phase_step_rad;
|
||||
if (acq_parameters.use_automatic_resampler)
|
||||
@@ -324,7 +285,7 @@ void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t
|
||||
}
|
||||
float _phase[1];
|
||||
_phase[0] = 0.0;
|
||||
volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples);
|
||||
volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase, carrier_vector.length());
|
||||
}
|
||||
|
||||
|
||||
@@ -344,27 +305,18 @@ void pcps_acquisition::init()
|
||||
d_num_doppler_bins = static_cast<uint32_t>(std::ceil(static_cast<double>(static_cast<int32_t>(acq_parameters.doppler_max) - static_cast<int32_t>(-acq_parameters.doppler_max)) / static_cast<double>(d_doppler_step)));
|
||||
|
||||
// Create the carrier Doppler wipeoff signals
|
||||
if (d_grid_doppler_wipeoffs == nullptr)
|
||||
if (d_grid_doppler_wipeoffs.empty())
|
||||
{
|
||||
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
|
||||
d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_bins, std::vector<std::complex<float>>(d_fft_size));
|
||||
}
|
||||
if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two == nullptr))
|
||||
if (acq_parameters.make_2_steps && (d_grid_doppler_wipeoffs_step_two.empty()))
|
||||
{
|
||||
d_grid_doppler_wipeoffs_step_two = new gr_complex*[d_num_doppler_bins_step2];
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++)
|
||||
{
|
||||
d_grid_doppler_wipeoffs_step_two[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
}
|
||||
d_grid_doppler_wipeoffs_step_two = std::vector<std::vector<std::complex<float>>>(d_num_doppler_bins_step2, std::vector<std::complex<float>>(d_fft_size));
|
||||
}
|
||||
|
||||
if (d_magnitude_grid == nullptr)
|
||||
if (d_magnitude_grid.empty())
|
||||
{
|
||||
d_magnitude_grid = new float*[d_num_doppler_bins];
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||
{
|
||||
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
d_magnitude_grid[doppler_index] = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
}
|
||||
d_magnitude_grid = std::vector<std::vector<float>>(d_num_doppler_bins, std::vector<float>(d_fft_size));
|
||||
}
|
||||
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||
@@ -374,7 +326,7 @@ void pcps_acquisition::init()
|
||||
d_magnitude_grid[doppler_index][k] = 0.0;
|
||||
}
|
||||
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
|
||||
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_old_freq + doppler);
|
||||
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_old_freq + doppler);
|
||||
}
|
||||
|
||||
d_worker_active = false;
|
||||
@@ -393,7 +345,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs()
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||
{
|
||||
int32_t doppler = -static_cast<int32_t>(acq_parameters.doppler_max) + d_doppler_step * doppler_index;
|
||||
update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_old_freq + doppler);
|
||||
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size), d_old_freq + doppler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +355,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs_step2()
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++)
|
||||
{
|
||||
float doppler = (static_cast<float>(doppler_index) - static_cast<float>(floor(d_num_doppler_bins_step2 / 2.0))) * acq_parameters.doppler_step2;
|
||||
update_local_carrier(d_grid_doppler_wipeoffs_step_two[doppler_index], d_fft_size, d_doppler_center_step_two + doppler);
|
||||
update_local_carrier(gsl::span<gr_complex>(d_grid_doppler_wipeoffs_step_two[doppler_index].data(), d_fft_size), d_doppler_center_step_two + doppler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +402,7 @@ void pcps_acquisition::send_positive_acquisition()
|
||||
|
||||
if (!d_channel_fsm.expired())
|
||||
{
|
||||
//the channel FSM is set, so, notify it directly the positive acquisition to minimize delays
|
||||
// the channel FSM is set, so, notify it directly the positive acquisition to minimize delays
|
||||
d_channel_fsm.lock()->Event_valid_acquisition();
|
||||
}
|
||||
else
|
||||
@@ -510,11 +462,11 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
|
||||
|
||||
dims[0] = static_cast<size_t>(1);
|
||||
dims[1] = static_cast<size_t>(1);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &acq_parameters.doppler_max, 0);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims, &acq_parameters.doppler_max, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_doppler_step, 0);
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_doppler_step, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
@@ -552,7 +504,7 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("num_dwells", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_num_noncoherent_integrations_counter, 0);
|
||||
matvar = Mat_VarCreate("num_dwells", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_num_noncoherent_integrations_counter, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
@@ -592,7 +544,7 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t&
|
||||
// Find the correlation peak and the carrier frequency
|
||||
for (uint32_t i = 0; i < num_doppler_bins; i++)
|
||||
{
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i], d_fft_size);
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i].data(), d_fft_size);
|
||||
if (d_magnitude_grid[i][tmp_intex_t] > grid_maximum)
|
||||
{
|
||||
grid_maximum = d_magnitude_grid[i][tmp_intex_t];
|
||||
@@ -629,7 +581,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
|
||||
// Find the correlation peak and the carrier frequency
|
||||
for (uint32_t i = 0; i < num_doppler_bins; i++)
|
||||
{
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i], d_fft_size);
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_magnitude_grid[i].data(), d_fft_size);
|
||||
if (d_magnitude_grid[i][tmp_intex_t] > firstPeak)
|
||||
{
|
||||
firstPeak = d_magnitude_grid[i][tmp_intex_t];
|
||||
@@ -663,7 +615,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
|
||||
}
|
||||
|
||||
int32_t idx = excludeRangeIndex1;
|
||||
memcpy(d_tmp_buffer, d_magnitude_grid[index_doppler], d_fft_size);
|
||||
memcpy(d_tmp_buffer.data(), d_magnitude_grid[index_doppler].data(), d_fft_size);
|
||||
do
|
||||
{
|
||||
d_tmp_buffer[idx] = 0.0;
|
||||
@@ -676,7 +628,7 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
|
||||
while (idx != excludeRangeIndex2);
|
||||
|
||||
// Find the second highest correlation peak in the same freq. bin ---
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_tmp_buffer, d_fft_size);
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_tmp_buffer.data(), d_fft_size);
|
||||
float secondPeak = d_tmp_buffer[tmp_intex_t];
|
||||
|
||||
// Compute the test statistics and compare to the threshold
|
||||
@@ -694,9 +646,9 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
int32_t effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
|
||||
if (d_cshort)
|
||||
{
|
||||
volk_gnsssdr_16ic_convert_32fc(d_data_buffer, d_data_buffer_sc, d_consumed_samples);
|
||||
volk_gnsssdr_16ic_convert_32fc(d_data_buffer.data(), d_data_buffer_sc.data(), d_consumed_samples);
|
||||
}
|
||||
memcpy(d_input_signal, d_data_buffer, d_consumed_samples * sizeof(gr_complex));
|
||||
memcpy(d_input_signal.data(), d_data_buffer.data(), d_consumed_samples * sizeof(gr_complex));
|
||||
if (d_fft_size > d_consumed_samples)
|
||||
{
|
||||
for (uint32_t i = d_consumed_samples; i < d_fft_size; i++)
|
||||
@@ -704,7 +656,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
d_input_signal[i] = gr_complex(0.0, 0.0);
|
||||
}
|
||||
}
|
||||
const gr_complex* in = d_input_signal; // Get the input samples pointer
|
||||
const gr_complex* in = d_input_signal.data(); // Get the input samples pointer
|
||||
|
||||
d_input_power = 0.0;
|
||||
d_mag = 0.0;
|
||||
@@ -722,8 +674,8 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
if (d_use_CFAR_algorithm_flag or acq_parameters.bit_transition_flag)
|
||||
{
|
||||
// Compute the input signal power estimation
|
||||
volk_32fc_magnitude_squared_32f(d_tmp_buffer, in, d_fft_size);
|
||||
volk_32f_accumulator_s32f(&d_input_power, d_tmp_buffer, d_fft_size);
|
||||
volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), in, d_fft_size);
|
||||
volk_32f_accumulator_s32f(&d_input_power, d_tmp_buffer.data(), d_fft_size);
|
||||
d_input_power /= static_cast<float>(d_fft_size);
|
||||
}
|
||||
|
||||
@@ -733,14 +685,14 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||
{
|
||||
// Remove Doppler
|
||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size);
|
||||
|
||||
// Perform the FFT-based convolution (parallel time search)
|
||||
// Compute the FFT of the carrier wiped--off incoming signal
|
||||
d_fft_if->execute();
|
||||
|
||||
// Multiply carrier wiped--off, Fourier transformed incoming signal with the local FFT'd code reference
|
||||
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
|
||||
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes.data(), d_fft_size);
|
||||
|
||||
// Compute the inverse FFT
|
||||
d_ifft->execute();
|
||||
@@ -749,17 +701,17 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
|
||||
if (d_num_noncoherent_integrations_counter == 1)
|
||||
{
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index], d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index].data(), d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
volk_32fc_magnitude_squared_32f(d_tmp_buffer, d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index], d_magnitude_grid[doppler_index], d_tmp_buffer, effective_fft_size);
|
||||
volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index].data(), d_magnitude_grid[doppler_index].data(), d_tmp_buffer.data(), effective_fft_size);
|
||||
}
|
||||
// Record results to file if required
|
||||
if (d_dump and d_channel == d_dump_channel)
|
||||
{
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude_grid[doppler_index], sizeof(float) * effective_fft_size);
|
||||
memcpy(grid_.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -774,7 +726,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
}
|
||||
if (acq_parameters.use_automatic_resampler)
|
||||
{
|
||||
//take into account the acquisition resampler ratio
|
||||
// take into account the acquisition resampler ratio
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio;
|
||||
d_gnss_synchro->Acq_delay_samples -= static_cast<double>(acq_parameters.resampler_latency_samples); //account the resampler filter latency
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
@@ -791,7 +743,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
{
|
||||
for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins_step2; doppler_index++)
|
||||
{
|
||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs_step_two[doppler_index], d_fft_size);
|
||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs_step_two[doppler_index].data(), d_fft_size);
|
||||
|
||||
// Perform the FFT-based convolution (parallel time search)
|
||||
// Compute the FFT of the carrier wiped--off incoming signal
|
||||
@@ -799,7 +751,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
|
||||
// Multiply carrier wiped--off, Fourier transformed incoming signal
|
||||
// with the local FFT'd code reference using SIMD operations with VOLK library
|
||||
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes, d_fft_size);
|
||||
volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), d_fft_if->get_outbuf(), d_fft_codes.data(), d_fft_size);
|
||||
|
||||
// compute the inverse FFT
|
||||
d_ifft->execute();
|
||||
@@ -807,17 +759,17 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
size_t offset = (acq_parameters.bit_transition_flag ? effective_fft_size : 0);
|
||||
if (d_num_noncoherent_integrations_counter == 1)
|
||||
{
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index], d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
volk_32fc_magnitude_squared_32f(d_magnitude_grid[doppler_index].data(), d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
volk_32fc_magnitude_squared_32f(d_tmp_buffer, d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index], d_magnitude_grid[doppler_index], d_tmp_buffer, effective_fft_size);
|
||||
volk_32fc_magnitude_squared_32f(d_tmp_buffer.data(), d_ifft->get_outbuf() + offset, effective_fft_size);
|
||||
volk_32f_x2_add_32f(d_magnitude_grid[doppler_index].data(), d_magnitude_grid[doppler_index].data(), d_tmp_buffer.data(), effective_fft_size);
|
||||
}
|
||||
// Record results to file if required
|
||||
if (d_dump and d_channel == d_dump_channel)
|
||||
{
|
||||
memcpy(narrow_grid_.colptr(doppler_index), d_magnitude_grid[doppler_index], sizeof(float) * effective_fft_size);
|
||||
memcpy(narrow_grid_.colptr(doppler_index), d_magnitude_grid[doppler_index].data(), sizeof(float) * effective_fft_size);
|
||||
}
|
||||
}
|
||||
// Compute the test statistic
|
||||
@@ -832,7 +784,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
|
||||
|
||||
if (acq_parameters.use_automatic_resampler)
|
||||
{
|
||||
//take into account the acquisition resampler ratio
|
||||
// take into account the acquisition resampler ratio
|
||||
d_gnss_synchro->Acq_delay_samples = static_cast<double>(std::fmod(static_cast<float>(indext), acq_parameters.samples_per_code)) * acq_parameters.resampler_ratio;
|
||||
d_gnss_synchro->Acq_delay_samples -= static_cast<double>(acq_parameters.resampler_latency_samples); //account the resampler filter latency
|
||||
d_gnss_synchro->Acq_doppler_hz = static_cast<double>(doppler);
|
||||
|
||||
@@ -61,17 +61,25 @@
|
||||
#include <gnuradio/thread/thread.h> // for scoped_lock
|
||||
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <complex>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#if HAS_SPAN
|
||||
#include <span>
|
||||
namespace gsl = std;
|
||||
#else
|
||||
#include <gsl/gsl>
|
||||
#endif
|
||||
|
||||
class Gnss_Synchro;
|
||||
class pcps_acquisition;
|
||||
|
||||
using pcps_acquisition_sptr = boost::shared_ptr<pcps_acquisition>;
|
||||
|
||||
pcps_acquisition_sptr
|
||||
pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a Parallel Code Phase Search Acquisition.
|
||||
@@ -81,75 +89,6 @@ pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
*/
|
||||
class pcps_acquisition : public gr::block
|
||||
{
|
||||
private:
|
||||
friend pcps_acquisition_sptr
|
||||
pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
|
||||
pcps_acquisition(const Acq_Conf& conf_);
|
||||
|
||||
void update_local_carrier(gr_complex* carrier_vector, int32_t correlator_length_samples, float freq);
|
||||
void update_grid_doppler_wipeoffs();
|
||||
void update_grid_doppler_wipeoffs_step2();
|
||||
bool is_fdma();
|
||||
|
||||
void acquisition_core(uint64_t samp_count);
|
||||
|
||||
void send_negative_acquisition();
|
||||
|
||||
void send_positive_acquisition();
|
||||
|
||||
void dump_results(int32_t effective_fft_size);
|
||||
|
||||
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
|
||||
bool start();
|
||||
|
||||
|
||||
Acq_Conf acq_parameters;
|
||||
bool d_active;
|
||||
bool d_worker_active;
|
||||
bool d_cshort;
|
||||
bool d_step_two;
|
||||
bool d_use_CFAR_algorithm_flag;
|
||||
int32_t d_positive_acq;
|
||||
float d_threshold;
|
||||
float d_mag;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
float* d_magnitude;
|
||||
float** d_magnitude_grid;
|
||||
float* d_tmp_buffer;
|
||||
gr_complex* d_input_signal;
|
||||
uint32_t d_samplesPerChip;
|
||||
int64_t d_old_freq;
|
||||
int32_t d_state;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
uint32_t d_doppler_step;
|
||||
float d_doppler_center_step_two;
|
||||
uint32_t d_num_noncoherent_integrations_counter;
|
||||
uint32_t d_fft_size;
|
||||
uint32_t d_consumed_samples;
|
||||
uint32_t d_num_doppler_bins;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
gr_complex** d_grid_doppler_wipeoffs_step_two;
|
||||
gr_complex* d_fft_codes;
|
||||
gr_complex* d_data_buffer;
|
||||
lv_16sc_t* d_data_buffer_sc;
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
arma::fmat grid_;
|
||||
arma::fmat narrow_grid_;
|
||||
uint32_t d_num_doppler_bins_step2;
|
||||
int64_t d_dump_number;
|
||||
uint32_t d_dump_channel;
|
||||
uint32_t d_buffer_count;
|
||||
bool d_dump;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
~pcps_acquisition();
|
||||
|
||||
@@ -249,7 +188,6 @@ public:
|
||||
d_doppler_step = doppler_step;
|
||||
}
|
||||
|
||||
|
||||
void set_resampler_latency(uint32_t latency_samples);
|
||||
|
||||
/*!
|
||||
@@ -258,6 +196,63 @@ public:
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
private:
|
||||
friend pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_);
|
||||
pcps_acquisition(const Acq_Conf& conf_);
|
||||
bool d_active;
|
||||
bool d_worker_active;
|
||||
bool d_cshort;
|
||||
bool d_step_two;
|
||||
bool d_use_CFAR_algorithm_flag;
|
||||
bool d_dump;
|
||||
int32_t d_state;
|
||||
int32_t d_positive_acq;
|
||||
uint32_t d_channel;
|
||||
uint32_t d_samplesPerChip;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_num_noncoherent_integrations_counter;
|
||||
uint32_t d_fft_size;
|
||||
uint32_t d_consumed_samples;
|
||||
uint32_t d_num_doppler_bins;
|
||||
uint32_t d_num_doppler_bins_step2;
|
||||
uint32_t d_dump_channel;
|
||||
uint32_t d_buffer_count;
|
||||
uint64_t d_sample_counter;
|
||||
int64_t d_dump_number;
|
||||
int64_t d_old_freq;
|
||||
float d_threshold;
|
||||
float d_mag;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
float d_doppler_center_step_two;
|
||||
std::string d_dump_filename;
|
||||
std::vector<std::vector<float>> d_magnitude_grid;
|
||||
std::vector<float> d_tmp_buffer;
|
||||
std::vector<std::complex<float>> d_input_signal;
|
||||
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
|
||||
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs_step_two;
|
||||
std::vector<std::complex<float>> d_fft_codes;
|
||||
std::vector<std::complex<float>> d_data_buffer;
|
||||
std::vector<lv_16sc_t> d_data_buffer_sc;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
Acq_Conf acq_parameters;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
arma::fmat grid_;
|
||||
arma::fmat narrow_grid_;
|
||||
void update_local_carrier(gsl::span<gr_complex> carrier_vector, float freq);
|
||||
void update_grid_doppler_wipeoffs();
|
||||
void update_grid_doppler_wipeoffs_step2();
|
||||
void acquisition_core(uint64_t samp_count);
|
||||
void send_negative_acquisition();
|
||||
void send_positive_acquisition();
|
||||
void dump_results(int32_t effective_fft_size);
|
||||
bool is_fdma();
|
||||
bool start();
|
||||
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
float max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_PCPS_ACQUISITION_H_*/
|
||||
|
||||
@@ -93,10 +93,10 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
|
||||
d_10_ms_buffer = static_cast<gr_complex *>(volk_gnsssdr_malloc(50 * d_samples_per_ms * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
|
||||
// For dumping samples into a file
|
||||
d_dump = conf_.dump;
|
||||
@@ -138,8 +138,6 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
|
||||
d_threshold = 0;
|
||||
d_num_doppler_points = 0;
|
||||
d_doppler_step = 0;
|
||||
d_grid_data = nullptr;
|
||||
d_grid_doppler_wipeoffs = nullptr;
|
||||
d_gnss_synchro = nullptr;
|
||||
d_code_phase = 0;
|
||||
d_doppler_freq = 0;
|
||||
@@ -168,6 +166,7 @@ unsigned int pcps_acquisition_fine_doppler_cc::nextPowerOf2(unsigned int n)
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_step)
|
||||
{
|
||||
d_doppler_step = doppler_step;
|
||||
@@ -175,11 +174,7 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste
|
||||
|
||||
d_num_doppler_points = floor(std::abs(2 * d_config_doppler_max) / d_doppler_step);
|
||||
|
||||
d_grid_data = new float *[d_num_doppler_points];
|
||||
for (int i = 0; i < d_num_doppler_points; i++)
|
||||
{
|
||||
d_grid_data[i] = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
}
|
||||
d_grid_data = std::vector<std::vector<float>>(d_num_doppler_points, std::vector<float>(d_fft_size));
|
||||
|
||||
if (d_dump)
|
||||
{
|
||||
@@ -190,27 +185,12 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition_fine_doppler_cc::free_grid_memory()
|
||||
{
|
||||
for (int i = 0; i < d_num_doppler_points; i++)
|
||||
{
|
||||
volk_gnsssdr_free(d_grid_data[i]);
|
||||
delete[] d_grid_doppler_wipeoffs[i];
|
||||
}
|
||||
delete d_grid_data;
|
||||
delete d_grid_doppler_wipeoffs;
|
||||
}
|
||||
|
||||
|
||||
pcps_acquisition_fine_doppler_cc::~pcps_acquisition_fine_doppler_cc()
|
||||
{
|
||||
volk_gnsssdr_free(d_carrier);
|
||||
volk_gnsssdr_free(d_fft_codes);
|
||||
volk_gnsssdr_free(d_magnitude);
|
||||
volk_gnsssdr_free(d_10_ms_buffer);
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
free_grid_memory();
|
||||
}
|
||||
|
||||
|
||||
@@ -266,17 +246,16 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
|
||||
// create the carrier Doppler wipeoff signals
|
||||
int doppler_hz;
|
||||
float phase_step_rad;
|
||||
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_points];
|
||||
d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_points, std::vector<std::complex<float>>(d_fft_size));
|
||||
for (int doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
|
||||
{
|
||||
doppler_hz = d_doppler_step * doppler_index - d_config_doppler_max;
|
||||
// doppler search steps
|
||||
// compute the carrier doppler wipe-off signal and store it
|
||||
phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
|
||||
d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size];
|
||||
float _phase[1];
|
||||
_phase[0] = 0;
|
||||
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size);
|
||||
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase, d_fft_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +273,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
|
||||
//--- Find the correlation peak and the carrier frequency --------------
|
||||
for (int i = 0; i < d_num_doppler_points; i++)
|
||||
{
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i], d_fft_size);
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i].data(), d_fft_size);
|
||||
if (d_grid_data[i][tmp_intex_t] > firstPeak)
|
||||
{
|
||||
firstPeak = d_grid_data[i][tmp_intex_t];
|
||||
@@ -305,7 +284,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
|
||||
// Record results to file if required
|
||||
if (d_dump and d_channel == d_dump_channel)
|
||||
{
|
||||
memcpy(grid_.colptr(i), d_grid_data[i], sizeof(float) * d_fft_size);
|
||||
memcpy(grid_.colptr(i), d_grid_data[i].data(), sizeof(float) * d_fft_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +316,7 @@ double pcps_acquisition_fine_doppler_cc::compute_CAF()
|
||||
while (idx != excludeRangeIndex2);
|
||||
|
||||
//--- Find the second highest correlation peak in the same freq. bin ---
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[index_doppler], d_fft_size);
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[index_doppler].data(), d_fft_size);
|
||||
float secondPeak = d_grid_data[index_doppler][tmp_intex_t];
|
||||
|
||||
// 5- Compute the test statistics and compare to the threshold
|
||||
@@ -383,7 +362,7 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
|
||||
{
|
||||
// doppler search steps
|
||||
// Perform the carrier wipe-off
|
||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size);
|
||||
|
||||
// 3- Perform the FFT-based convolution (parallel time search)
|
||||
// Compute the FFT of the carrier wiped--off incoming signal
|
||||
@@ -399,7 +378,7 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
|
||||
// save the grid matrix delay file
|
||||
volk_32fc_magnitude_squared_32f(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size);
|
||||
//accumulate grid values
|
||||
volk_32f_x2_add_32f(d_grid_data[doppler_index], d_grid_data[doppler_index], p_tmp_vector, d_fft_size);
|
||||
volk_32f_x2_add_32f(d_grid_data[doppler_index].data(), d_grid_data[doppler_index].data(), p_tmp_vector, d_fft_size);
|
||||
}
|
||||
|
||||
volk_gnsssdr_free(p_tmp_vector);
|
||||
@@ -423,14 +402,14 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
|
||||
int signal_samples = prn_replicas * d_fft_size;
|
||||
//int fft_size_extended = nextPowerOf2(signal_samples * zero_padding_factor);
|
||||
int fft_size_extended = signal_samples * zero_padding_factor;
|
||||
auto *fft_operator = new gr::fft::fft_complex(fft_size_extended, true);
|
||||
auto fft_operator = std::make_shared<gr::fft::fft_complex>(fft_size_extended, true);
|
||||
//zero padding the entire vector
|
||||
std::fill_n(fft_operator->get_inbuf(), fft_size_extended, gr_complex(0.0, 0.0));
|
||||
|
||||
//1. generate local code aligned with the acquisition code phase estimation
|
||||
auto *code_replica = static_cast<gr_complex *>(volk_gnsssdr_malloc(signal_samples * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
gps_l1_ca_code_gen_complex_sampled(code_replica, d_gnss_synchro->PRN, d_fs_in, 0);
|
||||
gps_l1_ca_code_gen_complex_sampled(gsl::span<gr_complex>(code_replica, signal_samples * sizeof(gr_complex)), d_gnss_synchro->PRN, d_fs_in, 0);
|
||||
|
||||
int shift_index = static_cast<int>(d_gnss_synchro->Acq_delay_samples);
|
||||
|
||||
@@ -460,9 +439,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
|
||||
|
||||
//case even
|
||||
int counter = 0;
|
||||
auto *fftFreqBins = new float[fft_size_extended];
|
||||
|
||||
std::fill_n(fftFreqBins, fft_size_extended, 0.0);
|
||||
auto fftFreqBins = std::vector<float>(fft_size_extended);
|
||||
|
||||
for (int k = 0; k < (fft_size_extended / 2); k++)
|
||||
{
|
||||
@@ -489,10 +466,8 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
|
||||
}
|
||||
|
||||
// free memory!!
|
||||
delete fft_operator;
|
||||
volk_gnsssdr_free(code_replica);
|
||||
volk_gnsssdr_free(p_tmp_vector);
|
||||
delete[] fftFreqBins;
|
||||
return d_fft_size;
|
||||
}
|
||||
|
||||
@@ -705,11 +680,11 @@ void pcps_acquisition_fine_doppler_cc::dump_results(int effective_fft_size)
|
||||
|
||||
dims[0] = static_cast<size_t>(1);
|
||||
dims[1] = static_cast<size_t>(1);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_config_doppler_max, 0);
|
||||
matvar = Mat_VarCreate("doppler_max", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_config_doppler_max, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_doppler_step, 0);
|
||||
matvar = Mat_VarCreate("doppler_step", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_doppler_step, 0);
|
||||
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
|
||||
Mat_VarFree(matvar);
|
||||
|
||||
|
||||
@@ -58,15 +58,16 @@
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class pcps_acquisition_fine_doppler_cc;
|
||||
|
||||
using pcps_acquisition_fine_doppler_cc_sptr = boost::shared_ptr<pcps_acquisition_fine_doppler_cc>;
|
||||
|
||||
pcps_acquisition_fine_doppler_cc_sptr
|
||||
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
|
||||
pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a Parallel Code Phase Search Acquisition.
|
||||
@@ -74,63 +75,6 @@ pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
|
||||
*/
|
||||
class pcps_acquisition_fine_doppler_cc : public gr::block
|
||||
{
|
||||
private:
|
||||
friend pcps_acquisition_fine_doppler_cc_sptr
|
||||
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
|
||||
pcps_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
|
||||
|
||||
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
|
||||
int estimate_Doppler();
|
||||
float estimate_input_power(gr_vector_const_void_star& input_items);
|
||||
double compute_CAF();
|
||||
void reset_grid();
|
||||
void update_carrier_wipeoff();
|
||||
void free_grid_memory();
|
||||
bool start();
|
||||
|
||||
Acq_Conf acq_parameters;
|
||||
int64_t d_fs_in;
|
||||
int d_samples_per_ms;
|
||||
int d_max_dwells;
|
||||
int d_gnuradio_forecast_samples;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
int d_config_doppler_max;
|
||||
|
||||
int d_num_doppler_points;
|
||||
int d_doppler_step;
|
||||
unsigned int d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex* d_carrier;
|
||||
gr_complex* d_fft_codes;
|
||||
gr_complex* d_10_ms_buffer;
|
||||
float* d_magnitude;
|
||||
|
||||
float** d_grid_data;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
unsigned int d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_test_statistics;
|
||||
int d_positive_acq;
|
||||
|
||||
int d_state;
|
||||
bool d_active;
|
||||
int d_well_count;
|
||||
int d_n_samples_in_buffer;
|
||||
bool d_dump;
|
||||
unsigned int d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
|
||||
std::string d_dump_filename;
|
||||
|
||||
arma::fmat grid_;
|
||||
int64_t d_dump_number;
|
||||
unsigned int d_dump_channel;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
@@ -220,20 +164,11 @@ public:
|
||||
void set_doppler_step(unsigned int doppler_step);
|
||||
|
||||
/*!
|
||||
* \brief If set to 1, ensures that acquisition starts at the
|
||||
* first available sample.
|
||||
* \param state - int=1 forces start of acquisition
|
||||
*/
|
||||
void set_state(int state);
|
||||
|
||||
/*!
|
||||
* \brief Parallel Code Phase Search Acquisition signal processing.
|
||||
* \brief If set to 1, ensures that acquisition starts at the
|
||||
* first available sample.
|
||||
* \param state - int=1 forces start of acquisition
|
||||
*/
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
void set_state(int state);
|
||||
|
||||
/*!
|
||||
* \brief Obtains the next power of 2 greater or equal to the input parameter
|
||||
@@ -242,6 +177,64 @@ public:
|
||||
unsigned int nextPowerOf2(unsigned int n);
|
||||
|
||||
void dump_results(int effective_fft_size);
|
||||
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
/*!
|
||||
* \brief Parallel Code Phase Search Acquisition signal processing.
|
||||
*/
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
private:
|
||||
friend pcps_acquisition_fine_doppler_cc_sptr
|
||||
pcps_make_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
|
||||
pcps_acquisition_fine_doppler_cc(const Acq_Conf& conf_);
|
||||
|
||||
int compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
|
||||
int estimate_Doppler();
|
||||
float estimate_input_power(gr_vector_const_void_star& input_items);
|
||||
double compute_CAF();
|
||||
void reset_grid();
|
||||
void update_carrier_wipeoff();
|
||||
bool start();
|
||||
Acq_Conf acq_parameters;
|
||||
int64_t d_fs_in;
|
||||
int d_samples_per_ms;
|
||||
int d_max_dwells;
|
||||
int d_gnuradio_forecast_samples;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
int d_config_doppler_max;
|
||||
int d_num_doppler_points;
|
||||
int d_doppler_step;
|
||||
unsigned int d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex* d_carrier;
|
||||
gr_complex* d_fft_codes;
|
||||
gr_complex* d_10_ms_buffer;
|
||||
float* d_magnitude;
|
||||
std::vector<std::vector<float>> d_grid_data;
|
||||
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
unsigned int d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_test_statistics;
|
||||
int d_positive_acq;
|
||||
int d_state;
|
||||
bool d_active;
|
||||
int d_well_count;
|
||||
int d_n_samples_in_buffer;
|
||||
bool d_dump;
|
||||
unsigned int d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
arma::fmat grid_;
|
||||
int64_t d_dump_number;
|
||||
unsigned int d_dump_channel;
|
||||
};
|
||||
|
||||
#endif /* pcps_acquisition_fine_doppler_cc*/
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "pcps_acquisition_fpga.h"
|
||||
#include "gnss_synchro.h"
|
||||
//#include <boost/chrono.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <cmath> // for ceil
|
||||
#include <iostream> // for operator<<
|
||||
@@ -87,6 +86,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_)
|
||||
|
||||
pcps_acquisition_fpga::~pcps_acquisition_fpga() = default;
|
||||
|
||||
|
||||
void pcps_acquisition_fpga::set_local_code()
|
||||
{
|
||||
acquisition_fpga->set_local_code(d_gnss_synchro->PRN);
|
||||
@@ -243,6 +243,7 @@ void pcps_acquisition_fpga::send_negative_acquisition()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_min)
|
||||
{
|
||||
uint32_t indext = 0U;
|
||||
|
||||
@@ -62,7 +62,7 @@ typedef struct
|
||||
int32_t code_length;
|
||||
uint32_t select_queue_Fpga;
|
||||
std::string device_name;
|
||||
uint32_t* all_fft_codes; // pointer to memory that contains all the code ffts
|
||||
uint32_t* all_fft_codes; // pointer to memory that contains all the code ffts
|
||||
//float downsampling_factor;
|
||||
uint32_t downsampling_factor;
|
||||
uint32_t total_block_exp;
|
||||
@@ -78,8 +78,7 @@ class pcps_acquisition_fpga;
|
||||
|
||||
using pcps_acquisition_fpga_sptr = boost::shared_ptr<pcps_acquisition_fpga>;
|
||||
|
||||
pcps_acquisition_fpga_sptr
|
||||
pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
|
||||
pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
|
||||
|
||||
/*!
|
||||
* \brief This class implements a Parallel Code Phase Search Acquisition that uses the FPGA.
|
||||
@@ -89,49 +88,6 @@ pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
|
||||
*/
|
||||
class pcps_acquisition_fpga
|
||||
{
|
||||
private:
|
||||
friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
|
||||
|
||||
pcps_acquisition_fpga(pcpsconf_fpga_t conf_);
|
||||
|
||||
void send_negative_acquisition();
|
||||
|
||||
void send_positive_acquisition();
|
||||
|
||||
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
|
||||
void acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_max);
|
||||
|
||||
pcpsconf_fpga_t acq_parameters;
|
||||
bool d_active;
|
||||
float d_threshold;
|
||||
float d_mag;
|
||||
float d_input_power;
|
||||
uint32_t d_doppler_index;
|
||||
float d_test_statistics;
|
||||
int32_t d_state;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_fft_size;
|
||||
uint32_t d_num_doppler_bins;
|
||||
uint64_t d_sample_counter;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
std::shared_ptr<Fpga_Acquisition> acquisition_fpga;
|
||||
|
||||
//float d_downsampling_factor;
|
||||
uint32_t d_downsampling_factor;
|
||||
uint32_t d_select_queue_Fpga;
|
||||
|
||||
uint32_t d_total_block_exp;
|
||||
|
||||
bool d_make_2_steps;
|
||||
uint32_t d_num_doppler_bins_step2;
|
||||
float d_doppler_step2;
|
||||
float d_doppler_center_step_two;
|
||||
uint32_t d_max_num_acqs;
|
||||
|
||||
public:
|
||||
~pcps_acquisition_fpga();
|
||||
|
||||
@@ -229,6 +185,39 @@ public:
|
||||
* \brief This funciton triggers a HW reset of the FPGA PL.
|
||||
*/
|
||||
void reset_acquisition(void);
|
||||
|
||||
private:
|
||||
friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_);
|
||||
pcps_acquisition_fpga(pcpsconf_fpga_t conf_);
|
||||
bool d_active;
|
||||
bool d_make_2_steps;
|
||||
uint32_t d_doppler_index;
|
||||
uint32_t d_channel;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_fft_size;
|
||||
uint32_t d_num_doppler_bins;
|
||||
uint32_t d_downsampling_factor;
|
||||
uint32_t d_select_queue_Fpga;
|
||||
uint32_t d_total_block_exp;
|
||||
uint32_t d_num_doppler_bins_step2;
|
||||
uint32_t d_max_num_acqs;
|
||||
int32_t d_state;
|
||||
uint64_t d_sample_counter;
|
||||
float d_threshold;
|
||||
float d_mag;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
float d_doppler_step2;
|
||||
float d_doppler_center_step_two;
|
||||
pcpsconf_fpga_t acq_parameters;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
std::shared_ptr<Fpga_Acquisition> acquisition_fpga;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
void send_negative_acquisition();
|
||||
void send_positive_acquisition();
|
||||
void acquisition_core(uint32_t num_doppler_bins, uint32_t doppler_step, int32_t doppler_max);
|
||||
float first_vs_second_peak_statistic(uint32_t& indext, int32_t& doppler, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step);
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_PCPS_ACQUISITION_FPGA_H_*/
|
||||
|
||||
@@ -82,10 +82,10 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
|
||||
d_carrier = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
|
||||
// For dumping samples into a file
|
||||
d_dump = dump;
|
||||
@@ -97,8 +97,6 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
|
||||
d_doppler_min = 0;
|
||||
d_num_doppler_points = 0;
|
||||
d_doppler_step = 0;
|
||||
d_grid_data = nullptr;
|
||||
d_grid_doppler_wipeoffs = nullptr;
|
||||
d_gnss_synchro = nullptr;
|
||||
d_code_phase = 0;
|
||||
d_doppler_freq = 0;
|
||||
@@ -114,23 +112,10 @@ void pcps_assisted_acquisition_cc::set_doppler_step(uint32_t doppler_step)
|
||||
}
|
||||
|
||||
|
||||
void pcps_assisted_acquisition_cc::free_grid_memory()
|
||||
{
|
||||
for (int32_t i = 0; i < d_num_doppler_points; i++)
|
||||
{
|
||||
delete[] d_grid_data[i];
|
||||
delete[] d_grid_doppler_wipeoffs[i];
|
||||
}
|
||||
delete d_grid_data;
|
||||
}
|
||||
|
||||
|
||||
pcps_assisted_acquisition_cc::~pcps_assisted_acquisition_cc()
|
||||
{
|
||||
volk_gnsssdr_free(d_carrier);
|
||||
volk_gnsssdr_free(d_fft_codes);
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
try
|
||||
{
|
||||
if (d_dump)
|
||||
@@ -236,26 +221,21 @@ void pcps_assisted_acquisition_cc::redefine_grid()
|
||||
// Create the search grid array
|
||||
d_num_doppler_points = floor(std::abs(d_doppler_max - d_doppler_min) / d_doppler_step);
|
||||
|
||||
d_grid_data = new float *[d_num_doppler_points];
|
||||
for (int32_t i = 0; i < d_num_doppler_points; i++)
|
||||
{
|
||||
d_grid_data[i] = new float[d_fft_size];
|
||||
}
|
||||
d_grid_data = std::vector<std::vector<float>>(d_num_doppler_points, std::vector<float>(d_fft_size));
|
||||
|
||||
// create the carrier Doppler wipeoff signals
|
||||
int32_t doppler_hz;
|
||||
float phase_step_rad;
|
||||
d_grid_doppler_wipeoffs = new gr_complex *[d_num_doppler_points];
|
||||
d_grid_doppler_wipeoffs = std::vector<std::vector<std::complex<float>>>(d_num_doppler_points, std::vector<std::complex<float>>(d_fft_size));
|
||||
for (int32_t doppler_index = 0; doppler_index < d_num_doppler_points; doppler_index++)
|
||||
{
|
||||
doppler_hz = d_doppler_min + d_doppler_step * doppler_index;
|
||||
// doppler search steps
|
||||
// compute the carrier doppler wipe-off signal and store it
|
||||
phase_step_rad = static_cast<float>(GPS_TWO_PI) * doppler_hz / static_cast<float>(d_fs_in);
|
||||
d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size];
|
||||
float _phase[1];
|
||||
_phase[0] = 0;
|
||||
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size);
|
||||
volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase, d_fft_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +250,7 @@ double pcps_assisted_acquisition_cc::search_maximum()
|
||||
|
||||
for (int32_t i = 0; i < d_num_doppler_points; i++)
|
||||
{
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i], d_fft_size);
|
||||
volk_gnsssdr_32f_index_max_32u(&tmp_intex_t, d_grid_data[i].data(), d_fft_size);
|
||||
if (d_grid_data[i][tmp_intex_t] > magt)
|
||||
{
|
||||
magt = d_grid_data[i][index_time];
|
||||
@@ -302,7 +282,7 @@ double pcps_assisted_acquisition_cc::search_maximum()
|
||||
<< "_" << d_gnss_synchro->Signal << "_sat_"
|
||||
<< d_gnss_synchro->PRN << "_doppler_" << d_gnss_synchro->Acq_doppler_hz << ".dat";
|
||||
d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary);
|
||||
d_dump_file.write(reinterpret_cast<char *>(d_grid_data[index_doppler]), n); //write directly |abs(x)|^2 in this Doppler bin?
|
||||
d_dump_file.write(reinterpret_cast<char *>(d_grid_data[index_doppler].data()), n); //write directly |abs(x)|^2 in this Doppler bin?
|
||||
d_dump_file.close();
|
||||
}
|
||||
|
||||
@@ -345,7 +325,7 @@ int32_t pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_cons
|
||||
{
|
||||
// doppler search steps
|
||||
// Perform the carrier wipe-off
|
||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index], d_fft_size);
|
||||
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in, d_grid_doppler_wipeoffs[doppler_index].data(), d_fft_size);
|
||||
// 3- Perform the FFT-based convolution (parallel time search)
|
||||
// Compute the FFT of the carrier wiped--off incoming signal
|
||||
d_fft_if->execute();
|
||||
@@ -359,8 +339,8 @@ int32_t pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_cons
|
||||
|
||||
// save the grid matrix delay file
|
||||
volk_32fc_magnitude_squared_32f(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size);
|
||||
const float *old_vector = d_grid_data[doppler_index];
|
||||
volk_32f_x2_add_32f(d_grid_data[doppler_index], old_vector, p_tmp_vector, d_fft_size);
|
||||
const float *old_vector = d_grid_data[doppler_index].data();
|
||||
volk_32f_x2_add_32f(d_grid_data[doppler_index].data(), old_vector, p_tmp_vector, d_fft_size);
|
||||
}
|
||||
volk_gnsssdr_free(p_tmp_vector);
|
||||
return d_fft_size;
|
||||
@@ -441,7 +421,6 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
|
||||
consume_each(ninput_items[0]);
|
||||
break;
|
||||
case 4: // RedefineGrid
|
||||
free_grid_memory();
|
||||
redefine_grid();
|
||||
reset_grid();
|
||||
d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
|
||||
@@ -460,7 +439,6 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
|
||||
d_active = false;
|
||||
// Send message to channel port //0=STOP_CHANNEL 1=ACQ_SUCCESS 2=ACQ_FAIL
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(1));
|
||||
free_grid_memory();
|
||||
// consume samples to not block the GNU Radio flowgraph
|
||||
d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
|
||||
consume_each(ninput_items[0]);
|
||||
@@ -478,7 +456,6 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
|
||||
d_active = false;
|
||||
// Send message to channel port //0=STOP_CHANNEL 1=ACQ_SUCCESS 2=ACQ_FAIL
|
||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(2));
|
||||
free_grid_memory();
|
||||
// consume samples to not block the GNU Radio flowgraph
|
||||
d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
|
||||
consume_each(ninput_items[0]);
|
||||
|
||||
@@ -54,15 +54,16 @@
|
||||
#include <gnuradio/fft/fft.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class pcps_assisted_acquisition_cc;
|
||||
|
||||
using pcps_assisted_acquisition_cc_sptr = boost::shared_ptr<pcps_assisted_acquisition_cc>;
|
||||
|
||||
pcps_assisted_acquisition_cc_sptr
|
||||
pcps_make_assisted_acquisition_cc(
|
||||
pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(
|
||||
int32_t max_dwells,
|
||||
uint32_t sampled_ms,
|
||||
int32_t doppler_max,
|
||||
@@ -79,69 +80,6 @@ pcps_make_assisted_acquisition_cc(
|
||||
*/
|
||||
class pcps_assisted_acquisition_cc : public gr::block
|
||||
{
|
||||
private:
|
||||
friend pcps_assisted_acquisition_cc_sptr
|
||||
pcps_make_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
|
||||
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
|
||||
int32_t samples_per_ms, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
pcps_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
|
||||
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
|
||||
int32_t samples_per_ms, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
int32_t compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
|
||||
float estimate_input_power(gr_vector_const_void_star& input_items);
|
||||
double search_maximum();
|
||||
void get_assistance();
|
||||
void reset_grid();
|
||||
void redefine_grid();
|
||||
void free_grid_memory();
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_max_dwells;
|
||||
uint32_t d_doppler_resolution;
|
||||
int32_t d_gnuradio_forecast_samples;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
int32_t d_doppler_max;
|
||||
int32_t d_doppler_min;
|
||||
int32_t d_config_doppler_max;
|
||||
int32_t d_config_doppler_min;
|
||||
|
||||
int32_t d_num_doppler_points;
|
||||
int32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex* d_carrier;
|
||||
gr_complex* d_fft_codes;
|
||||
|
||||
float** d_grid_data;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
std::ofstream d_dump_file;
|
||||
int32_t d_state;
|
||||
bool d_active;
|
||||
bool d_disable_assist;
|
||||
int32_t d_well_count;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
@@ -237,6 +175,68 @@ public:
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
void forecast(int noutput_items, gr_vector_int& ninput_items_required);
|
||||
|
||||
private:
|
||||
friend pcps_assisted_acquisition_cc_sptr
|
||||
pcps_make_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
|
||||
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
|
||||
int32_t samples_per_ms, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
pcps_assisted_acquisition_cc(int32_t max_dwells, uint32_t sampled_ms,
|
||||
int32_t doppler_max, int32_t doppler_min, int64_t fs_in,
|
||||
int32_t samples_per_ms, bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
int32_t compute_and_accumulate_grid(gr_vector_const_void_star& input_items);
|
||||
float estimate_input_power(gr_vector_const_void_star& input_items);
|
||||
double search_maximum();
|
||||
void get_assistance();
|
||||
void reset_grid();
|
||||
void redefine_grid();
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_max_dwells;
|
||||
uint32_t d_doppler_resolution;
|
||||
int32_t d_gnuradio_forecast_samples;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
int32_t d_doppler_max;
|
||||
int32_t d_doppler_min;
|
||||
int32_t d_config_doppler_max;
|
||||
int32_t d_config_doppler_min;
|
||||
|
||||
int32_t d_num_doppler_points;
|
||||
int32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex* d_carrier;
|
||||
gr_complex* d_fft_codes;
|
||||
|
||||
std::vector<std::vector<float>> d_grid_data;
|
||||
std::vector<std::vector<std::complex<float>>> d_grid_doppler_wipeoffs;
|
||||
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
std::ofstream d_dump_file;
|
||||
int32_t d_state;
|
||||
bool d_active;
|
||||
bool d_disable_assist;
|
||||
int32_t d_well_count;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_PCPS_assisted_acquisition_cc_H_*/
|
||||
|
||||
@@ -97,10 +97,10 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
|
||||
d_magnitude = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
|
||||
// For dumping samples into a file
|
||||
d_dump = dump;
|
||||
@@ -137,9 +137,6 @@ pcps_cccwsr_acquisition_cc::~pcps_cccwsr_acquisition_cc()
|
||||
volk_gnsssdr_free(d_correlation_minus);
|
||||
volk_gnsssdr_free(d_magnitude);
|
||||
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
|
||||
try
|
||||
{
|
||||
if (d_dump)
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <gnuradio/fft/fft.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -51,8 +52,7 @@ class pcps_cccwsr_acquisition_cc;
|
||||
|
||||
using pcps_cccwsr_acquisition_cc_sptr = boost::shared_ptr<pcps_cccwsr_acquisition_cc>;
|
||||
|
||||
pcps_cccwsr_acquisition_cc_sptr
|
||||
pcps_cccwsr_make_acquisition_cc(
|
||||
pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(
|
||||
uint32_t sampled_ms,
|
||||
uint32_t max_dwells,
|
||||
uint32_t doppler_max,
|
||||
@@ -68,59 +68,6 @@ pcps_cccwsr_make_acquisition_cc(
|
||||
*/
|
||||
class pcps_cccwsr_acquisition_cc : public gr::block
|
||||
{
|
||||
private:
|
||||
friend pcps_cccwsr_acquisition_cc_sptr
|
||||
pcps_cccwsr_make_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int32_t samples_per_ms, int32_t samples_per_code,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
pcps_cccwsr_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int32_t samples_per_ms, int32_t samples_per_code,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_samples_per_code;
|
||||
uint32_t d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_max_dwells;
|
||||
uint32_t d_well_count;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_code_data;
|
||||
gr_complex* d_fft_code_pilot;
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitude;
|
||||
gr_complex* d_data_correlation;
|
||||
gr_complex* d_pilot_correlation;
|
||||
gr_complex* d_correlation_plus;
|
||||
gr_complex* d_correlation_minus;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int32_t d_state;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
@@ -225,6 +172,59 @@ public:
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
private:
|
||||
friend pcps_cccwsr_acquisition_cc_sptr
|
||||
pcps_cccwsr_make_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int32_t samples_per_ms, int32_t samples_per_code,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
pcps_cccwsr_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int32_t samples_per_ms, int32_t samples_per_code,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_samples_per_code;
|
||||
uint32_t d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_max_dwells;
|
||||
uint32_t d_well_count;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_code_data;
|
||||
gr_complex* d_fft_code_pilot;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitude;
|
||||
gr_complex* d_data_correlation;
|
||||
gr_complex* d_pilot_correlation;
|
||||
gr_complex* d_correlation_plus;
|
||||
gr_complex* d_correlation_minus;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int32_t d_state;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_PCPS_CCCWSR_ACQUISITION_CC_H_*/
|
||||
|
||||
@@ -131,10 +131,10 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
|
||||
if (d_opencl != 0)
|
||||
{
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
}
|
||||
|
||||
// For dumping samples into a file
|
||||
@@ -179,11 +179,6 @@ pcps_opencl_acquisition_cc::~pcps_opencl_acquisition_cc()
|
||||
|
||||
clFFT_DestroyPlan(d_cl_fft_plan);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -209,7 +204,7 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
|
||||
std::vector<cl::Platform> all_platforms;
|
||||
cl::Platform::get(&all_platforms);
|
||||
|
||||
if (all_platforms.size() == 0)
|
||||
if (all_platforms.empty())
|
||||
{
|
||||
std::cout << "No OpenCL platforms found. Check OpenCL installation!" << std::endl;
|
||||
return 1;
|
||||
@@ -223,7 +218,7 @@ int pcps_opencl_acquisition_cc::init_opencl_environment(const std::string &kerne
|
||||
std::vector<cl::Device> gpu_devices;
|
||||
d_cl_platform.getDevices(CL_DEVICE_TYPE_GPU, &gpu_devices);
|
||||
|
||||
if (gpu_devices.size() == 0)
|
||||
if (gpu_devices.empty())
|
||||
{
|
||||
std::cout << "No GPU devices found. Check OpenCL installation!" << std::endl;
|
||||
return 2;
|
||||
|
||||
@@ -51,31 +51,30 @@
|
||||
#ifndef GNSS_SDR_PCPS_OPENCL_ACQUISITION_CC_H_
|
||||
#define GNSS_SDR_PCPS_OPENCL_ACQUISITION_CC_H_
|
||||
|
||||
#define CL_SILENCE_DEPRECATION
|
||||
#include "channel_fsm.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "opencl/fft_internal.h"
|
||||
#include <gnuradio/block.h>
|
||||
#include <gnuradio/fft/fft.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include "opencl/cl.hpp"
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "opencl/cl.hpp"
|
||||
#else
|
||||
#include <CL/cl.hpp>
|
||||
#endif
|
||||
|
||||
class pcps_opencl_acquisition_cc;
|
||||
|
||||
typedef boost::shared_ptr<pcps_opencl_acquisition_cc> pcps_opencl_acquisition_cc_sptr;
|
||||
|
||||
pcps_opencl_acquisition_cc_sptr
|
||||
pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int samples_per_ms, int samples_per_code,
|
||||
pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc(
|
||||
uint32_t sampled_ms,
|
||||
uint32_t max_dwells,
|
||||
uint32_t doppler_max,
|
||||
int64_t fs_in,
|
||||
int samples_per_ms,
|
||||
int samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
@@ -88,6 +87,124 @@ pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||
*/
|
||||
class pcps_opencl_acquisition_cc : public gr::block
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
*/
|
||||
~pcps_opencl_acquisition_cc();
|
||||
|
||||
/*!
|
||||
* \brief Set acquisition/tracking common Gnss_Synchro object pointer
|
||||
* to exchange synchronization data between acquisition and tracking blocks.
|
||||
* \param p_gnss_synchro Satellite information shared by the processing blocks.
|
||||
*/
|
||||
inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
{
|
||||
d_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the maximum peak of grid search.
|
||||
*/
|
||||
inline uint32_t mag() const
|
||||
{
|
||||
return d_mag;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Initializes acquisition algorithm.
|
||||
*/
|
||||
void init();
|
||||
|
||||
/*!
|
||||
* \brief Sets local code for PCPS acquisition algorithm.
|
||||
* \param code - Pointer to the PRN code.
|
||||
*/
|
||||
void set_local_code(std::complex<float>* code);
|
||||
|
||||
/*!
|
||||
* \brief Starts acquisition algorithm, turning from standby mode to
|
||||
* active mode
|
||||
* \param active - bool that activates/deactivates the block.
|
||||
*/
|
||||
inline void set_active(bool active)
|
||||
{
|
||||
d_active = active;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief If set to 1, ensures that acquisition starts at the
|
||||
* first available sample.
|
||||
* \param state - int=1 forces start of acquisition
|
||||
*/
|
||||
void set_state(int state);
|
||||
|
||||
/*!
|
||||
* \brief Set acquisition channel unique ID
|
||||
* \param channel - receiver channel.
|
||||
*/
|
||||
inline void set_channel(uint32_t channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm)
|
||||
{
|
||||
d_channel_fsm = channel_fsm;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm.
|
||||
* \param threshold - Threshold for signal detection (check \ref Navitec2012,
|
||||
* Algorithm 1, for a definition of this threshold).
|
||||
*/
|
||||
inline void set_threshold(float threshold)
|
||||
{
|
||||
d_threshold = threshold;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set maximum Doppler grid search
|
||||
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
||||
*/
|
||||
inline void set_doppler_max(uint32_t doppler_max)
|
||||
{
|
||||
d_doppler_max = doppler_max;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set Doppler steps for the grid search
|
||||
* \param doppler_step - Frequency bin of the search grid [Hz].
|
||||
*/
|
||||
inline void set_doppler_step(uint32_t doppler_step)
|
||||
{
|
||||
d_doppler_step = doppler_step;
|
||||
}
|
||||
|
||||
inline bool opencl_ready() const
|
||||
{
|
||||
bool ready = false;
|
||||
if (d_opencl == 0)
|
||||
{
|
||||
ready = true;
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
|
||||
void acquisition_core_volk();
|
||||
|
||||
void acquisition_core_opencl();
|
||||
|
||||
/*!
|
||||
* \brief Parallel Code Phase Search Acquisition signal processing.
|
||||
*/
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
private:
|
||||
friend pcps_opencl_acquisition_cc_sptr
|
||||
pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
|
||||
@@ -127,8 +244,8 @@ private:
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_codes;
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
@@ -148,6 +265,8 @@ private:
|
||||
gr_complex** d_in_buffer;
|
||||
std::vector<uint64_t> d_sample_counter_buffer;
|
||||
uint32_t d_in_dwell_count;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
int d_opencl;
|
||||
|
||||
cl::Platform d_cl_platform;
|
||||
cl::Device d_cl_device;
|
||||
@@ -162,116 +281,6 @@ private:
|
||||
cl::CommandQueue* d_cl_queue;
|
||||
clFFT_Plan d_cl_fft_plan;
|
||||
cl_int d_cl_fft_batch_size;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
int d_opencl;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
*/
|
||||
~pcps_opencl_acquisition_cc();
|
||||
|
||||
/*!
|
||||
* \brief Set acquisition/tracking common Gnss_Synchro object pointer
|
||||
* to exchange synchronization data between acquisition and tracking blocks.
|
||||
* \param p_gnss_synchro Satellite information shared by the processing blocks.
|
||||
*/
|
||||
inline void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
|
||||
{
|
||||
d_gnss_synchro = p_gnss_synchro;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the maximum peak of grid search.
|
||||
*/
|
||||
inline uint32_t mag() const
|
||||
{
|
||||
return d_mag;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Initializes acquisition algorithm.
|
||||
*/
|
||||
void init();
|
||||
|
||||
/*!
|
||||
* \brief Sets local code for PCPS acquisition algorithm.
|
||||
* \param code - Pointer to the PRN code.
|
||||
*/
|
||||
void set_local_code(std::complex<float>* code);
|
||||
|
||||
/*!
|
||||
* \brief Starts acquisition algorithm, turning from standby mode to
|
||||
* active mode
|
||||
* \param active - bool that activates/deactivates the block.
|
||||
*/
|
||||
inline void set_active(bool active)
|
||||
{
|
||||
d_active = active;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief If set to 1, ensures that acquisition starts at the
|
||||
* first available sample.
|
||||
* \param state - int=1 forces start of acquisition
|
||||
*/
|
||||
void set_state(int state);
|
||||
|
||||
/*!
|
||||
* \brief Set acquisition channel unique ID
|
||||
* \param channel - receiver channel.
|
||||
*/
|
||||
inline void set_channel(uint32_t channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Set channel fsm associated to this acquisition instance
|
||||
*/
|
||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm)
|
||||
{
|
||||
d_channel_fsm = channel_fsm;
|
||||
}
|
||||
/*!
|
||||
* \brief Set statistics threshold of PCPS algorithm.
|
||||
* \param threshold - Threshold for signal detection (check \ref Navitec2012,
|
||||
* Algorithm 1, for a definition of this threshold).
|
||||
*/
|
||||
inline void set_threshold(float threshold)
|
||||
{
|
||||
d_threshold = threshold;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set maximum Doppler grid search
|
||||
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
|
||||
*/
|
||||
inline void set_doppler_max(uint32_t doppler_max)
|
||||
{
|
||||
d_doppler_max = doppler_max;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set Doppler steps for the grid search
|
||||
* \param doppler_step - Frequency bin of the search grid [Hz].
|
||||
*/
|
||||
inline void set_doppler_step(uint32_t doppler_step)
|
||||
{
|
||||
d_doppler_step = doppler_step;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Parallel Code Phase Search Acquisition signal processing.
|
||||
*/
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
void acquisition_core_volk();
|
||||
|
||||
void acquisition_core_opencl();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -106,9 +106,9 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
|
||||
d_code = new gr_complex[d_samples_per_code]();
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
|
||||
// For dumping samples into a file
|
||||
d_dump = dump;
|
||||
@@ -122,7 +122,6 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
|
||||
d_threshold = 0;
|
||||
d_doppler_step = 0;
|
||||
d_grid_doppler_wipeoffs = nullptr;
|
||||
d_fft_if2 = nullptr;
|
||||
d_gnss_synchro = nullptr;
|
||||
d_code_phase = 0;
|
||||
d_doppler_freq = 0;
|
||||
@@ -150,8 +149,6 @@ pcps_quicksync_acquisition_cc::~pcps_quicksync_acquisition_cc()
|
||||
volk_gnsssdr_free(d_magnitude);
|
||||
volk_gnsssdr_free(d_magnitude_folded);
|
||||
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
delete d_code;
|
||||
delete d_possible_delay;
|
||||
delete d_corr_output_f;
|
||||
|
||||
@@ -67,8 +67,7 @@ class pcps_quicksync_acquisition_cc;
|
||||
|
||||
using pcps_quicksync_acquisition_cc_sptr = boost::shared_ptr<pcps_quicksync_acquisition_cc>;
|
||||
|
||||
pcps_quicksync_acquisition_cc_sptr
|
||||
pcps_quicksync_make_acquisition_cc(
|
||||
pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc(
|
||||
uint32_t folding_factor,
|
||||
uint32_t sampled_ms,
|
||||
uint32_t max_dwells,
|
||||
@@ -89,72 +88,6 @@ pcps_quicksync_make_acquisition_cc(
|
||||
*/
|
||||
class pcps_quicksync_acquisition_cc : public gr::block
|
||||
{
|
||||
private:
|
||||
friend pcps_quicksync_acquisition_cc_sptr
|
||||
pcps_quicksync_make_acquisition_cc(uint32_t folding_factor,
|
||||
uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int32_t samples_per_ms, int32_t samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
pcps_quicksync_acquisition_cc(uint32_t folding_factor,
|
||||
uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int32_t samples_per_ms, int32_t samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
gr_complex* d_code;
|
||||
uint32_t d_folding_factor; // also referred in the paper as 'p'
|
||||
float* d_corr_acumulator;
|
||||
uint32_t* d_possible_delay;
|
||||
float* d_corr_output_f;
|
||||
float* d_magnitude_folded;
|
||||
gr_complex* d_signal_folded;
|
||||
gr_complex* d_code_folded;
|
||||
float d_noise_floor_power;
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_samples_per_code;
|
||||
uint32_t d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_max_dwells;
|
||||
uint32_t d_well_count;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_codes;
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_fft_if2;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitude;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
bool d_bit_transition_flag;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int32_t d_state;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
@@ -258,6 +191,70 @@ public:
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
private:
|
||||
friend pcps_quicksync_acquisition_cc_sptr
|
||||
pcps_quicksync_make_acquisition_cc(uint32_t folding_factor,
|
||||
uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int32_t samples_per_ms, int32_t samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
pcps_quicksync_acquisition_cc(uint32_t folding_factor,
|
||||
uint32_t sampled_ms, uint32_t max_dwells,
|
||||
uint32_t doppler_max, int64_t fs_in,
|
||||
int32_t samples_per_ms, int32_t samples_per_code,
|
||||
bool bit_transition_flag,
|
||||
bool dump,
|
||||
std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
gr_complex* d_code;
|
||||
uint32_t d_folding_factor; // also referred in the paper as 'p'
|
||||
float* d_corr_acumulator;
|
||||
uint32_t* d_possible_delay;
|
||||
float* d_corr_output_f;
|
||||
float* d_magnitude_folded;
|
||||
gr_complex* d_signal_folded;
|
||||
gr_complex* d_code_folded;
|
||||
float d_noise_floor_power;
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_samples_per_code;
|
||||
uint32_t d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_max_dwells;
|
||||
uint32_t d_well_count;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_codes;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitude;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
bool d_bit_transition_flag;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int32_t d_state;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_PCPS_ACQUISITION_CC_H_*/
|
||||
#endif /* GNSS_SDR_PCPS_QUICKSYNC_ACQUISITION_CC_H_ */
|
||||
|
||||
@@ -113,10 +113,10 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
|
||||
d_magnitude = static_cast<float *>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||
|
||||
// Direct FFT
|
||||
d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
|
||||
d_fft_if = std::make_shared<gr::fft::fft_complex>(d_fft_size, true);
|
||||
|
||||
// Inverse FFT
|
||||
d_ifft = new gr::fft::fft_complex(d_fft_size, false);
|
||||
d_ifft = std::make_shared<gr::fft::fft_complex>(d_fft_size, false);
|
||||
|
||||
// For dumping samples into a file
|
||||
d_dump = dump;
|
||||
@@ -134,6 +134,7 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
|
||||
d_channel = 0;
|
||||
}
|
||||
|
||||
|
||||
pcps_tong_acquisition_cc::~pcps_tong_acquisition_cc()
|
||||
{
|
||||
if (d_num_doppler_bins > 0)
|
||||
@@ -150,9 +151,6 @@ pcps_tong_acquisition_cc::~pcps_tong_acquisition_cc()
|
||||
volk_gnsssdr_free(d_fft_codes);
|
||||
volk_gnsssdr_free(d_magnitude);
|
||||
|
||||
delete d_ifft;
|
||||
delete d_fft_if;
|
||||
|
||||
try
|
||||
{
|
||||
if (d_dump)
|
||||
|
||||
@@ -65,8 +65,7 @@ class pcps_tong_acquisition_cc;
|
||||
|
||||
using pcps_tong_acquisition_cc_sptr = boost::shared_ptr<pcps_tong_acquisition_cc>;
|
||||
|
||||
pcps_tong_acquisition_cc_sptr
|
||||
pcps_tong_make_acquisition_cc(
|
||||
pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(
|
||||
uint32_t sampled_ms,
|
||||
uint32_t doppler_max,
|
||||
int64_t fs_in,
|
||||
@@ -84,60 +83,6 @@ pcps_tong_make_acquisition_cc(
|
||||
*/
|
||||
class pcps_tong_acquisition_cc : public gr::block
|
||||
{
|
||||
private:
|
||||
friend pcps_tong_acquisition_cc_sptr
|
||||
pcps_tong_make_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
|
||||
int64_t fs_in, int32_t samples_per_ms,
|
||||
int32_t samples_per_code, uint32_t tong_init_val,
|
||||
uint32_t tong_max_val, uint32_t tong_max_dwells,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
pcps_tong_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
|
||||
int64_t fs_in, int32_t samples_per_ms,
|
||||
int32_t samples_per_code, uint32_t tong_init_val,
|
||||
uint32_t tong_max_val, uint32_t tong_max_dwells,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_samples_per_code;
|
||||
uint32_t d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_dwell_count;
|
||||
uint32_t d_tong_count;
|
||||
uint32_t d_tong_init_val;
|
||||
uint32_t d_tong_max_val;
|
||||
uint32_t d_tong_max_dwells;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_codes;
|
||||
float** d_grid_data;
|
||||
gr::fft::fft_complex* d_fft_if;
|
||||
gr::fft::fft_complex* d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitude;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int32_t d_state;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief Default destructor.
|
||||
@@ -241,6 +186,60 @@ public:
|
||||
int general_work(int noutput_items, gr_vector_int& ninput_items,
|
||||
gr_vector_const_void_star& input_items,
|
||||
gr_vector_void_star& output_items);
|
||||
|
||||
private:
|
||||
friend pcps_tong_acquisition_cc_sptr
|
||||
pcps_tong_make_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
|
||||
int64_t fs_in, int32_t samples_per_ms,
|
||||
int32_t samples_per_code, uint32_t tong_init_val,
|
||||
uint32_t tong_max_val, uint32_t tong_max_dwells,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
pcps_tong_acquisition_cc(uint32_t sampled_ms, uint32_t doppler_max,
|
||||
int64_t fs_in, int32_t samples_per_ms,
|
||||
int32_t samples_per_code, uint32_t tong_init_val,
|
||||
uint32_t tong_max_val, uint32_t tong_max_dwells,
|
||||
bool dump, std::string dump_filename);
|
||||
|
||||
void calculate_magnitudes(gr_complex* fft_begin, int32_t doppler_shift,
|
||||
int32_t doppler_offset);
|
||||
|
||||
int64_t d_fs_in;
|
||||
int32_t d_samples_per_ms;
|
||||
int32_t d_samples_per_code;
|
||||
uint32_t d_doppler_resolution;
|
||||
float d_threshold;
|
||||
std::string d_satellite_str;
|
||||
uint32_t d_doppler_max;
|
||||
uint32_t d_doppler_step;
|
||||
uint32_t d_sampled_ms;
|
||||
uint32_t d_dwell_count;
|
||||
uint32_t d_tong_count;
|
||||
uint32_t d_tong_init_val;
|
||||
uint32_t d_tong_max_val;
|
||||
uint32_t d_tong_max_dwells;
|
||||
uint32_t d_fft_size;
|
||||
uint64_t d_sample_counter;
|
||||
gr_complex** d_grid_doppler_wipeoffs;
|
||||
uint32_t d_num_doppler_bins;
|
||||
gr_complex* d_fft_codes;
|
||||
float** d_grid_data;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_fft_if;
|
||||
std::shared_ptr<gr::fft::fft_complex> d_ifft;
|
||||
Gnss_Synchro* d_gnss_synchro;
|
||||
uint32_t d_code_phase;
|
||||
float d_doppler_freq;
|
||||
float d_mag;
|
||||
float* d_magnitude;
|
||||
float d_input_power;
|
||||
float d_test_statistics;
|
||||
std::ofstream d_dump_file;
|
||||
bool d_active;
|
||||
int32_t d_state;
|
||||
bool d_dump;
|
||||
uint32_t d_channel;
|
||||
std::weak_ptr<ChannelFsm> d_channel_fsm;
|
||||
std::string d_dump_filename;
|
||||
};
|
||||
|
||||
#endif /* GNSS_SDR_PCPS_TONG_ACQUISITION_CC_H_ */
|
||||
|
||||
@@ -81,7 +81,6 @@ Fpga_Acquisition::Fpga_Acquisition(std::string device_name,
|
||||
int64_t fs_in,
|
||||
uint32_t sampled_ms __attribute__((unused)),
|
||||
uint32_t select_queue,
|
||||
//lv_16sc_t *all_fft_codes,
|
||||
uint32_t *all_fft_codes,
|
||||
uint32_t excludelimit)
|
||||
{
|
||||
@@ -209,6 +208,7 @@ void Fpga_Acquisition::set_block_exp(uint32_t total_block_exp)
|
||||
d_map_base[11] = total_block_exp;
|
||||
}
|
||||
|
||||
|
||||
void Fpga_Acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_step, int32_t doppler_min)
|
||||
{
|
||||
float phase_step_rad_real;
|
||||
@@ -233,7 +233,6 @@ void Fpga_Acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_s
|
||||
void Fpga_Acquisition::configure_acquisition()
|
||||
{
|
||||
//Fpga_Acquisition::open_device();
|
||||
|
||||
d_map_base[0] = d_select_queue;
|
||||
d_map_base[1] = d_vector_length;
|
||||
d_map_base[2] = d_nsamples;
|
||||
@@ -319,6 +318,7 @@ void Fpga_Acquisition::read_fpga_total_scale_factor(uint32_t *total_scale_factor
|
||||
*fw_scale_factor = 0;
|
||||
}
|
||||
|
||||
|
||||
void Fpga_Acquisition::read_result_valid(uint32_t *result_valid)
|
||||
{
|
||||
uint32_t readval = 0;
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#ifndef GNSS_SDR_FPGA_ACQUISITION_H_
|
||||
#define GNSS_SDR_FPGA_ACQUISITION_H_
|
||||
|
||||
#include <volk/volk_complex.h> // for lv_16sc_t
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
@@ -46,7 +45,8 @@
|
||||
class Fpga_Acquisition
|
||||
{
|
||||
public:
|
||||
Fpga_Acquisition(std::string device_name,
|
||||
Fpga_Acquisition(
|
||||
std::string device_name,
|
||||
uint32_t nsamples,
|
||||
uint32_t doppler_max,
|
||||
uint32_t nsamples_total,
|
||||
@@ -57,13 +57,24 @@ public:
|
||||
uint32_t excludelimit);
|
||||
|
||||
~Fpga_Acquisition();
|
||||
|
||||
bool set_local_code(uint32_t PRN);
|
||||
|
||||
void set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_step, int32_t doppler_min);
|
||||
|
||||
void run_acquisition(void);
|
||||
|
||||
void read_acquisition_results(uint32_t *max_index, float *firstpeak, float *secondpeak, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index, uint32_t *total_blk_exp);
|
||||
void read_acquisition_results(
|
||||
uint32_t *max_index,
|
||||
float *firstpeak,
|
||||
float *secondpeak,
|
||||
uint64_t *initial_sample,
|
||||
float *power_sum,
|
||||
uint32_t *doppler_index,
|
||||
uint32_t *total_blk_exp);
|
||||
|
||||
void block_samples();
|
||||
|
||||
void unblock_samples();
|
||||
|
||||
/*!
|
||||
@@ -100,9 +111,10 @@ public:
|
||||
|
||||
void configure_acquisition(void);
|
||||
|
||||
void close_device();
|
||||
void open_device();
|
||||
|
||||
void close_device();
|
||||
|
||||
private:
|
||||
int64_t d_fs_in;
|
||||
// data related to the hardware module and the driver
|
||||
|
||||
Reference in New Issue
Block a user