Sort private members in headers

This commit is contained in:
Carles Fernandez 2020-06-25 11:58:01 +02:00
parent 5a3db5a53d
commit 63b7c00b16
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
27 changed files with 243 additions and 256 deletions

View File

@ -501,6 +501,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
rtklib_pvt_gs::~rtklib_pvt_gs()
{
DLOG(INFO) << "PVT block destructor called.";
if (d_sysv_msqid != -1)
{
msgctl(d_sysv_msqid, IPC_RMID, nullptr);

View File

@ -63,15 +63,15 @@ public:
private:
gr::blocks::char_to_short::sptr gr_char_to_short_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
bool dump_;
};
#endif

View File

@ -65,17 +65,17 @@ public:
private:
interleaved_byte_to_complex_byte_sptr ibyte_to_cbyte_;
conjugate_ic_sptr conjugate_ic_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
conjugate_ic_sptr conjugate_ic_;
bool inverted_spectrum;
bool dump_;
};
#endif

View File

@ -64,17 +64,17 @@ public:
private:
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex_;
conjugate_cc_sptr conjugate_cc_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
conjugate_cc_sptr conjugate_cc_;
bool inverted_spectrum;
bool dump_;
};
#endif

View File

@ -65,17 +65,17 @@ public:
private:
interleaved_byte_to_complex_short_sptr interleaved_byte_to_complex_short_;
conjugate_sc_sptr conjugate_sc_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
conjugate_sc_sptr conjugate_sc_;
bool inverted_spectrum;
bool dump_;
};
#endif

View File

@ -64,17 +64,17 @@ public:
private:
gr::blocks::interleaved_short_to_complex::sptr gr_interleaved_short_to_complex_;
conjugate_cc_sptr conjugate_cc_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
conjugate_cc_sptr conjugate_cc_;
bool inverted_spectrum;
bool dump_;
};
#endif

View File

@ -65,17 +65,17 @@ public:
private:
interleaved_short_to_complex_short_sptr interleaved_short_to_complex_short_;
conjugate_sc_sptr conjugate_sc_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
conjugate_sc_sptr conjugate_sc_;
bool inverted_spectrum;
bool dump_;
};
#endif

View File

@ -29,8 +29,8 @@
class ConfigurationInterface;
/*!
* \brief Interface of an adapter of a direct resampler conditioner block
* to a SignalConditionerInterface
* \brief Interface of an adapter of a digital beamformer block
* to a GNSSBlockInterface
*/
class BeamformerFilter : public GNSSBlockInterface
{
@ -46,7 +46,7 @@ public:
return role_;
}
//! returns "Direct_Resampler"
//! returns "Beamformer_Filte"
inline std::string implementation() override
{
return "Beamformer_Filter";
@ -63,16 +63,16 @@ public:
gr::basic_block_sptr get_right_block() override;
private:
std::string role_;
unsigned int in_stream_;
unsigned int out_stream_;
std::string item_type_;
size_t item_size_;
uint64_t samples_;
bool dump_;
std::string dump_filename_;
gr::block_sptr beamformer_;
gr::block_sptr file_sink_;
std::string role_;
std::string item_type_;
std::string dump_filename_;
size_t item_size_;
uint64_t samples_;
unsigned int in_stream_;
unsigned int out_stream_;
bool dump_;
};
#endif // GNSS_SDR_BEAMFORMER_FILTER_H

View File

@ -129,6 +129,74 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
}
void FirFilter::init()
{
std::string default_input_item_type = "gr_complex";
std::string default_output_item_type = "gr_complex";
std::string default_taps_item_type = "float";
std::string default_dump_filename = "../data/input_filter.dat";
int default_number_of_taps = 6;
unsigned int default_number_of_bands = 2;
std::vector<double> default_bands = {0.0, 0.4, 0.6, 1.0};
std::vector<double> default_ampl = {1.0, 1.0, 0.0, 0.0};
std::vector<double> default_error_w = {1.0, 1.0};
std::string default_filter_type = "bandpass";
int default_grid_density = 16;
DLOG(INFO) << "role " << role_;
input_item_type_ = config_->property(role_ + ".input_item_type", default_input_item_type);
output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type);
taps_item_type_ = config_->property(role_ + ".taps_item_type", default_taps_item_type);
dump_ = config_->property(role_ + ".dump", false);
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
int number_of_taps = config_->property(role_ + ".number_of_taps", default_number_of_taps);
unsigned int number_of_bands = config_->property(role_ + ".number_of_bands", default_number_of_bands);
std::vector<double> bands;
std::vector<double> ampl;
std::vector<double> error_w;
std::string option;
double option_value;
for (unsigned int i = 0; i < number_of_bands; i++)
{
option = ".band" + std::to_string(i + 1) + "_begin";
option_value = config_->property(role_ + option, default_bands[i]);
bands.push_back(option_value);
option = ".band" + std::to_string(i + 1) + "_end";
option_value = config_->property(role_ + option, default_bands[i]);
bands.push_back(option_value);
option = ".ampl" + std::to_string(i + 1) + "_begin";
option_value = config_->property(role_ + option, default_bands[i]);
ampl.push_back(option_value);
option = ".ampl" + std::to_string(i + 1) + "_end";
option_value = config_->property(role_ + option, default_bands[i]);
ampl.push_back(option_value);
option = ".band" + std::to_string(i + 1) + "_error";
option_value = config_->property(role_ + option, default_bands[i]);
error_w.push_back(option_value);
}
std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type);
int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
// pm_remez implements the Parks-McClellan FIR filter design.
// It calculates the optimal (in the Chebyshev/minimax sense) FIR filter
// impulse response given a set of band edges, the desired response on
// those bands, and the weight given to the error in those bands.
std::vector<double> taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density);
taps_.reserve(taps_d.size());
for (double& it : taps_d)
{
taps_.push_back(static_cast<float>(it));
}
}
void FirFilter::connect(gr::top_block_sptr top_block)
{
if ((taps_item_type_ == "float") && (input_item_type_ == "gr_complex") && (output_item_type_ == "gr_complex"))
@ -313,71 +381,3 @@ gr::basic_block_sptr FirFilter::get_right_block()
LOG(WARNING) << "Unknown input filter taps item type";
return nullptr;
}
void FirFilter::init()
{
std::string default_input_item_type = "gr_complex";
std::string default_output_item_type = "gr_complex";
std::string default_taps_item_type = "float";
std::string default_dump_filename = "../data/input_filter.dat";
int default_number_of_taps = 6;
unsigned int default_number_of_bands = 2;
std::vector<double> default_bands = {0.0, 0.4, 0.6, 1.0};
std::vector<double> default_ampl = {1.0, 1.0, 0.0, 0.0};
std::vector<double> default_error_w = {1.0, 1.0};
std::string default_filter_type = "bandpass";
int default_grid_density = 16;
DLOG(INFO) << "role " << role_;
input_item_type_ = config_->property(role_ + ".input_item_type", default_input_item_type);
output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type);
taps_item_type_ = config_->property(role_ + ".taps_item_type", default_taps_item_type);
dump_ = config_->property(role_ + ".dump", false);
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
int number_of_taps = config_->property(role_ + ".number_of_taps", default_number_of_taps);
unsigned int number_of_bands = config_->property(role_ + ".number_of_bands", default_number_of_bands);
std::vector<double> bands;
std::vector<double> ampl;
std::vector<double> error_w;
std::string option;
double option_value;
for (unsigned int i = 0; i < number_of_bands; i++)
{
option = ".band" + std::to_string(i + 1) + "_begin";
option_value = config_->property(role_ + option, default_bands[i]);
bands.push_back(option_value);
option = ".band" + std::to_string(i + 1) + "_end";
option_value = config_->property(role_ + option, default_bands[i]);
bands.push_back(option_value);
option = ".ampl" + std::to_string(i + 1) + "_begin";
option_value = config_->property(role_ + option, default_bands[i]);
ampl.push_back(option_value);
option = ".ampl" + std::to_string(i + 1) + "_end";
option_value = config_->property(role_ + option, default_bands[i]);
ampl.push_back(option_value);
option = ".band" + std::to_string(i + 1) + "_error";
option_value = config_->property(role_ + option, default_bands[i]);
error_w.push_back(option_value);
}
std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type);
int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
// pm_remez implements the Parks-McClellan FIR filter design.
// It calculates the optimal (in the Chebyshev/minimax sense) FIR filter
// impulse response given a set of band edges, the desired response on
// those bands, and the weight given to the error in those bands.
std::vector<double> taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density);
taps_.reserve(taps_d.size());
for (double& it : taps_d)
{
taps_.push_back(static_cast<float>(it));
}
}

View File

@ -86,30 +86,31 @@ public:
gr::basic_block_sptr get_right_block() override;
private:
void init();
gr::filter::fir_filter_ccf::sptr fir_filter_ccf_;
gr::filter::fir_filter_fff::sptr fir_filter_fff_1_;
gr::filter::fir_filter_fff::sptr fir_filter_fff_2_;
gr::blocks::float_to_complex::sptr float_to_complex_;
gr::blocks::float_to_short::sptr float_to_short_1_;
gr::blocks::float_to_short::sptr float_to_short_2_;
short_x2_to_cshort_sptr short_x2_to_cshort_;
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
byte_x2_to_complex_byte_sptr char_x2_cbyte_;
cshort_to_float_x2_sptr cshort_to_float_x2_;
gr::blocks::float_to_char::sptr float_to_char_1_;
gr::blocks::float_to_char::sptr float_to_char_2_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
bool dump_;
std::vector<float> taps_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string taps_item_type_;
std::vector<float> taps_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
void init();
complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
gr::filter::fir_filter_fff::sptr fir_filter_fff_1_;
gr::filter::fir_filter_fff::sptr fir_filter_fff_2_;
gr::blocks::float_to_char::sptr float_to_char_1_;
gr::blocks::float_to_char::sptr float_to_char_2_;
byte_x2_to_complex_byte_sptr char_x2_cbyte_;
gr::blocks::float_to_complex::sptr float_to_complex_;
cshort_to_float_x2_sptr cshort_to_float_x2_;
gr::blocks::float_to_short::sptr float_to_short_1_;
gr::blocks::float_to_short::sptr float_to_short_2_;
short_x2_to_cshort_sptr short_x2_to_cshort_;
bool dump_;
};
#endif

View File

@ -87,27 +87,27 @@ private:
gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_fir_filter_ccf_;
gr::filter::freq_xlating_fir_filter_fcf::sptr freq_xlating_fir_filter_fcf_;
gr::filter::freq_xlating_fir_filter_scf::sptr freq_xlating_fir_filter_scf_;
ConfigurationInterface* config_;
int decimation_factor_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
size_t input_size_;
std::string output_item_type_;
std::string taps_item_type_;
std::vector<float> taps_;
double intermediate_freq_;
double sampling_freq_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
gr::blocks::complex_to_float::sptr complex_to_float_;
gr::blocks::char_to_short::sptr gr_char_to_short_;
gr::blocks::float_to_short::sptr float_to_short_1_;
gr::blocks::float_to_short::sptr float_to_short_2_;
short_x2_to_cshort_sptr short_x2_to_cshort_;
complex_float_to_complex_byte_sptr complex_to_complex_byte_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
std::vector<float> taps_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string taps_item_type_;
std::string role_;
size_t input_size_;
double intermediate_freq_;
double sampling_freq_;
int decimation_factor_;
unsigned int in_streams_;
unsigned int out_streams_;
bool dump_;
};
#endif // GNSS_SDR_FREQ_XLATING_FIR_FILTER_H

View File

@ -38,6 +38,7 @@ public:
unsigned int out_streams);
~NotchFilter() = default;
std::string role()
{
return role_;
@ -48,24 +49,26 @@ public:
{
return "Notch_Filter";
}
size_t item_size()
{
return 0;
}
void connect(gr::top_block_sptr top_block);
void disconnect(gr::top_block_sptr top_block);
gr::basic_block_sptr get_left_block();
gr::basic_block_sptr get_right_block();
private:
bool dump_;
notch_sptr notch_filter_;
gr::blocks::file_sink::sptr file_sink_;
std::string dump_filename_;
std::string role_;
std::string item_type_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
notch_sptr notch_filter_;
bool dump_;
};
#endif // GNSS_SDR_NOTCH_FILTER_H

View File

@ -38,6 +38,7 @@ public:
unsigned int out_streams);
~NotchFilterLite() = default;
std::string role()
{
return role_;
@ -48,24 +49,26 @@ public:
{
return "Notch_Filter_Lite";
}
size_t item_size()
{
return 0;
}
void connect(gr::top_block_sptr top_block);
void disconnect(gr::top_block_sptr top_block);
gr::basic_block_sptr get_left_block();
gr::basic_block_sptr get_right_block();
private:
bool dump_;
notch_lite_sptr notch_filter_lite_;
gr::blocks::file_sink::sptr file_sink_;
std::string dump_filename_;
std::string role_;
std::string item_type_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
notch_lite_sptr notch_filter_lite_;
bool dump_;
};
#endif // GNSS_SDR_NOTCH_FILTER_LITE_H

View File

@ -64,19 +64,19 @@ public:
gr::basic_block_sptr get_right_block() override;
private:
ConfigurationInterface* config_;
bool dump_;
bool xlat_;
std::string dump_filename_;
std::string input_item_type_;
size_t input_size_;
std::string output_item_type_;
std::string role_;
unsigned int in_streams_;
unsigned int out_streams_;
gr::blocks::file_sink::sptr file_sink_;
pulse_blanking_cc_sptr pulse_blanking_cc_;
gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_;
gr::blocks::file_sink::sptr file_sink_;
ConfigurationInterface* config_;
std::string dump_filename_;
std::string input_item_type_;
std::string output_item_type_;
std::string role_;
size_t input_size_;
unsigned int in_streams_;
unsigned int out_streams_;
bool dump_;
bool xlat_;
};
#endif // GNSS_SDR_PULSE_BLANKING_FILTER_H

View File

@ -45,7 +45,9 @@ target_link_libraries(input_filter_gr_blocks
PUBLIC
Gnuradio::blocks
Gnuradio::filter
Volkgnsssdr::volkgnsssdr
PRIVATE
algorithms_libs
Volk::volk
Log4cpp::log4cpp
)

View File

@ -18,6 +18,7 @@
*/
#include "notch_cc.h"
#include "gnss_sdr_make_unique.h"
#include <boost/math/distributions/chi_squared.hpp>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -55,19 +56,11 @@ Notch::Notch(float pfa,
z_0 = gr_complex(0.0, 0.0);
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred);
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa));
c_samples = static_cast<gr_complex *>(volk_malloc(length_ * sizeof(gr_complex), volk_get_alignment()));
angle_ = static_cast<float *>(volk_malloc(length_ * sizeof(float), volk_get_alignment()));
power_spect = static_cast<float *>(volk_malloc(length_ * sizeof(float), volk_get_alignment()));
c_samples = volk_gnsssdr::vector<gr_complex>(length_);
angle_ = volk_gnsssdr::vector<float>(length_);
power_spect = volk_gnsssdr::vector<float>(length_);
last_out = gr_complex(0.0, 0.0);
d_fft = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(length_, true));
}
Notch::~Notch()
{
volk_free(c_samples);
volk_free(angle_);
volk_free(power_spect);
d_fft = std::make_unique<gr::fft::fft_complex>(length_, true);
}
@ -96,8 +89,8 @@ int Notch::general_work(int noutput_items, gr_vector_int &ninput_items __attribu
{
memcpy(d_fft->get_inbuf(), in, sizeof(gr_complex) * length_);
d_fft->execute();
volk_32fc_s32f_power_spectrum_32f(power_spect, d_fft->get_outbuf(), 1.0, length_);
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect, 15.0, length_);
volk_32fc_s32f_power_spectrum_32f(power_spect.data(), d_fft->get_outbuf(), 1.0, length_);
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect.data(), 15.0, length_);
sig2lin = std::pow(10.0, (sig2dB / 10.0)) / (static_cast<float>(n_deg_fred));
noise_pow_est = (static_cast<float>(n_segments) * noise_pow_est + sig2lin) / (static_cast<float>(n_segments + 1));
memcpy(out, in, sizeof(gr_complex) * length_);
@ -112,11 +105,11 @@ int Notch::general_work(int noutput_items, gr_vector_int &ninput_items __attribu
filter_state_ = true;
last_out = gr_complex(0, 0);
}
volk_32fc_x2_multiply_conjugate_32fc(c_samples, in, (in - 1), length_);
volk_32fc_s32f_atan2_32f(angle_, c_samples, static_cast<float>(1.0), length_);
volk_32fc_x2_multiply_conjugate_32fc(c_samples.data(), in, (in - 1), length_);
volk_32fc_s32f_atan2_32f(angle_.data(), c_samples.data(), static_cast<float>(1.0), length_);
for (int32_t aux = 0; aux < length_; aux++)
{
z_0 = std::exp(gr_complex(0, 1) * (*(angle_ + aux)));
z_0 = std::exp(gr_complex(0, 1) * (*(angle_.data() + aux)));
*(out + aux) = *(in + aux) - z_0 * (*(in + aux - 1)) + p_c_factor * z_0 * last_out;
last_out = *(out + aux);
}

View File

@ -27,6 +27,7 @@
#endif
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
#include <cstdint>
class Notch;
@ -50,7 +51,7 @@ notch_sptr make_notch_filter(
class Notch : public gr::block
{
public:
~Notch();
~Notch() = default;
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
@ -61,6 +62,13 @@ public:
private:
friend notch_sptr make_notch_filter(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
Notch(float pfa, float p_c_factor, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
std::unique_ptr<gr::fft::fft_complex> d_fft;
volk_gnsssdr::vector<gr_complex> c_samples;
volk_gnsssdr::vector<float> angle_;
volk_gnsssdr::vector<float> power_spect;
gr_complex last_out;
gr_complex z_0;
gr_complex p_c_factor;
float pfa;
float noise_pow_est;
float thres_;
@ -70,13 +78,6 @@ private:
uint32_t n_segments_est;
uint32_t n_segments_reset;
bool filter_state_;
gr_complex last_out;
gr_complex z_0;
gr_complex p_c_factor;
gr_complex *c_samples;
float *angle_;
float *power_spect;
std::unique_ptr<gr::fft::fft_complex> d_fft;
};
#endif // GNSS_SDR_NOTCH_H

View File

@ -18,6 +18,7 @@
*/
#include "notch_lite_cc.h"
#include "gnss_sdr_make_unique.h"
#include <boost/math/distributions/chi_squared.hpp>
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
@ -63,14 +64,8 @@ NotchLite::NotchLite(float p_c_factor,
c_samples2 = gr_complex(0.0, 0.0);
angle1 = 0.0;
angle2 = 0.0;
power_spect = static_cast<float *>(volk_malloc(length_ * sizeof(float), volk_get_alignment()));
d_fft = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(length_, true));
}
NotchLite::~NotchLite()
{
volk_free(power_spect);
power_spect = volk_gnsssdr::vector<float>(length_);
d_fft = std::make_unique<gr::fft::fft_complex>(length_, true);
}
@ -99,8 +94,8 @@ int NotchLite::general_work(int noutput_items, gr_vector_int &ninput_items __att
{
memcpy(d_fft->get_inbuf(), in, sizeof(gr_complex) * length_);
d_fft->execute();
volk_32fc_s32f_power_spectrum_32f(power_spect, d_fft->get_outbuf(), 1.0, length_);
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect, 15.0, length_);
volk_32fc_s32f_power_spectrum_32f(power_spect.data(), d_fft->get_outbuf(), 1.0, length_);
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect.data(), 15.0, length_);
sig2lin = std::pow(10.0, (sig2dB / 10.0)) / static_cast<float>(n_deg_fred);
noise_pow_est = (static_cast<float>(n_segments) * noise_pow_est + sig2lin) / static_cast<float>(n_segments + 1);
memcpy(out, in, sizeof(gr_complex) * length_);

View File

@ -27,6 +27,7 @@
#endif
#include <gnuradio/block.h>
#include <gnuradio/fft/fft.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
#include <cstdint>
class NotchLite;
@ -51,7 +52,7 @@ notch_lite_sptr make_notch_filter_lite(
class NotchLite : public gr::block
{
public:
~NotchLite();
~NotchLite() = default;
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
@ -62,6 +63,18 @@ public:
private:
friend notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
NotchLite(float p_c_factor, float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset, int32_t n_segments_coeff);
std::unique_ptr<gr::fft::fft_complex> d_fft;
volk_gnsssdr::vector<float> power_spect;
gr_complex last_out;
gr_complex z_0;
gr_complex p_c_factor;
gr_complex c_samples1;
gr_complex c_samples2;
float pfa;
float thres_;
float noise_pow_est;
float angle1;
float angle2;
int32_t length_;
int32_t n_segments;
int32_t n_segments_est;
@ -69,19 +82,7 @@ private:
int32_t n_segments_coeff_reset;
int32_t n_segments_coeff;
int32_t n_deg_fred;
float pfa;
float thres_;
float noise_pow_est;
bool filter_state_;
gr_complex last_out;
gr_complex z_0;
gr_complex p_c_factor;
gr_complex c_samples1;
gr_complex c_samples2;
float angle1;
float angle2;
float *power_spect;
std::unique_ptr<gr::fft::fft_complex> d_fft;
};
#endif // GNSS_SDR_NOTCH_LITE_H

View File

@ -50,17 +50,7 @@ pulse_blanking_cc::pulse_blanking_cc(float pfa,
n_deg_fred = 2 * length_;
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred);
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa));
zeros_ = static_cast<gr_complex *>(volk_malloc(length_ * sizeof(gr_complex), volk_get_alignment()));
for (int32_t aux = 0; aux < length_; aux++)
{
zeros_[aux] = gr_complex(0.0, 0.0);
}
}
pulse_blanking_cc::~pulse_blanking_cc()
{
volk_free(zeros_);
zeros_ = volk_gnsssdr::vector<gr_complex>(length_);
}
@ -78,13 +68,13 @@ int pulse_blanking_cc::general_work(int noutput_items, gr_vector_int &ninput_ite
{
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);
auto *out = reinterpret_cast<gr_complex *>(output_items[0]);
auto *magnitude = static_cast<float *>(volk_malloc(noutput_items * sizeof(float), volk_get_alignment()));
volk_32fc_magnitude_squared_32f(magnitude, in, noutput_items);
auto magnitude = volk_gnsssdr::vector<float>(noutput_items);
volk_32fc_magnitude_squared_32f(magnitude.data(), in, noutput_items);
int32_t sample_index = 0;
float segment_energy;
while ((sample_index + length_) < noutput_items)
{
volk_32f_accumulator_s32f(&segment_energy, (magnitude + sample_index), length_);
volk_32f_accumulator_s32f(&segment_energy, (magnitude.data() + sample_index), length_);
if ((n_segments < n_segments_est) && (last_filtered == false))
{
noise_power_estimation = (static_cast<float>(n_segments) * noise_power_estimation + segment_energy / static_cast<float>(n_deg_fred)) / static_cast<float>(n_segments + 1);
@ -94,7 +84,7 @@ int pulse_blanking_cc::general_work(int noutput_items, gr_vector_int &ninput_ite
{
if ((segment_energy / noise_power_estimation) > thres_)
{
memcpy(out, zeros_, sizeof(gr_complex) * length_);
memcpy(out, zeros_.data(), sizeof(gr_complex) * length_);
last_filtered = true;
}
else
@ -112,7 +102,6 @@ int pulse_blanking_cc::general_work(int noutput_items, gr_vector_int &ninput_ite
sample_index += length_;
n_segments++;
}
volk_free(magnitude);
consume_each(sample_index);
return sample_index;
}

View File

@ -26,6 +26,7 @@
#include <boost/shared_ptr.hpp>
#endif
#include <gnuradio/block.h>
#include <volk_gnsssdr/volk_gnsssdr_alloc.h> // for volk_gnsssdr::vector
#include <cstdint>
class pulse_blanking_cc;
@ -45,7 +46,7 @@ pulse_blanking_cc_sptr make_pulse_blanking_cc(
class pulse_blanking_cc : public gr::block
{
public:
~pulse_blanking_cc();
~pulse_blanking_cc() = default;
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
@ -55,16 +56,16 @@ public:
private:
friend pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
pulse_blanking_cc(float pfa, int32_t length_, int32_t n_segments_est, int32_t n_segments_reset);
volk_gnsssdr::vector<gr_complex> zeros_;
float noise_power_estimation;
float thres_;
float pfa;
int32_t length_;
int32_t n_segments;
int32_t n_segments_est;
int32_t n_segments_reset;
int32_t n_deg_fred;
bool last_filtered;
float noise_power_estimation;
float thres_;
float pfa;
gr_complex *zeros_;
};
#endif // GNSS_SDR_PULSE_BLANKING_H

View File

@ -78,14 +78,11 @@ private:
conjugate_cc_sptr conjugate_cc_;
conjugate_sc_sptr conjugate_sc_;
conjugate_ic_sptr conjugate_ic_;
std::string item_type_;
std::string role_;
size_t item_size_;
unsigned int in_streams_;
unsigned int out_streams_;
bool inverted_spectrum;
};

View File

@ -63,17 +63,17 @@ public:
gr::basic_block_sptr get_right_block() override;
private:
gr::block_sptr resampler_;
gr::block_sptr file_sink_;
std::string role_;
unsigned int in_stream_;
unsigned int out_stream_;
std::string item_type_;
size_t item_size_;
bool dump_;
std::string dump_filename_;
double sample_freq_in_;
double sample_freq_out_;
gr::block_sptr resampler_;
gr::block_sptr file_sink_;
size_t item_size_;
unsigned int in_stream_;
unsigned int out_stream_;
bool dump_;
};
#endif // GNSS_SDR_DIRECT_RESAMPLER_CONDITIONER_H

View File

@ -70,15 +70,6 @@ public:
gr::basic_block_sptr get_right_block() override;
private:
std::string role_;
unsigned int in_stream_;
unsigned int out_stream_;
std::string item_type_;
size_t item_size_;
bool dump_;
std::string dump_filename_;
double sample_freq_in_;
double sample_freq_out_;
#ifdef GR_GREATER_38
gr::filter::mmse_resampler_cc::sptr resampler_;
#else
@ -86,6 +77,15 @@ private:
#endif
gr::filter::fir_filter_ccf::sptr fir_filter_ccf_;
gr::block_sptr file_sink_;
std::string role_;
std::string item_type_;
std::string dump_filename_;
size_t item_size_;
double sample_freq_in_;
double sample_freq_out_;
unsigned int in_stream_;
unsigned int out_stream_;
bool dump_;
};
#endif // GNSS_SDR_FRACTIONAL_RESAMPLER_CONDITIONER_H

View File

@ -72,13 +72,6 @@ public:
gr::basic_block_sptr get_right_block() override;
private:
std::string role_;
unsigned int in_stream_;
unsigned int out_stream_;
std::string item_type_;
size_t item_size_;
bool dump_;
std::string dump_filename_;
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<gr::block> gen_source_;
#else
@ -86,6 +79,13 @@ private:
#endif
gr::blocks::vector_to_stream::sptr vector_to_stream_;
gr::blocks::file_sink::sptr file_sink_;
std::string role_;
std::string item_type_;
std::string dump_filename_;
size_t item_size_;
unsigned int in_stream_;
unsigned int out_stream_;
bool dump_;
};
#endif // GNSS_SDR_SIGNAL_GENERATOR_H

View File

@ -65,17 +65,17 @@ signal_generator_c::signal_generator_c(std::vector<std::string> signal1,
float BW_BB) : gr::block("signal_gen_cc", gr::io_signature::make(0, 0, sizeof(gr_complex)), gr::io_signature::make(1, 1, sizeof(gr_complex) * vector_length)),
signal_(std::move(signal1)),
system_(std::move(system)),
PRN_(PRN),
CN0_dB_(std::move(CN0_dB)),
doppler_Hz_(std::move(doppler_Hz)),
PRN_(PRN),
delay_chips_(std::move(delay_chips)),
delay_sec_(std::move(delay_sec)),
data_flag_(data_flag),
noise_flag_(noise_flag),
BW_BB_(BW_BB * static_cast<float>(fs_in) / 2.0),
fs_in_(fs_in),
num_sats_(PRN.size()),
vector_length_(vector_length),
BW_BB_(BW_BB * static_cast<float>(fs_in) / 2.0)
data_flag_(data_flag),
noise_flag_(noise_flag)
{
init();
generate_codes();

View File

@ -121,35 +121,35 @@ private:
void generate_codes();
std::random_device r;
std::uniform_int_distribution<int> uniform_dist;
std::normal_distribution<float> normal_dist;
std::vector<std::string> signal_;
std::vector<std::string> system_;
std::vector<unsigned int> PRN_;
std::vector<std::vector<gr_complex>> sampled_code_data_;
std::vector<std::vector<gr_complex>> sampled_code_pilot_;
std::vector<gr_complex> current_data_bits_;
std::vector<gr_complex> complex_phase_;
std::vector<float> CN0_dB_;
std::vector<float> doppler_Hz_;
std::vector<float> start_phase_rad_;
std::vector<unsigned int> PRN_;
std::vector<unsigned int> delay_chips_;
std::vector<unsigned int> delay_sec_;
bool data_flag_;
bool noise_flag_;
unsigned int fs_in_;
unsigned int num_sats_;
unsigned int vector_length_;
float BW_BB_;
std::vector<unsigned int> samples_per_code_;
std::vector<unsigned int> num_of_codes_per_vector_;
std::vector<unsigned int> data_bit_duration_ms_;
std::vector<unsigned int> ms_counter_;
std::vector<float> start_phase_rad_;
std::vector<gr_complex> current_data_bits_;
std::vector<signed int> current_data_bit_int_;
std::vector<signed int> data_modulation_;
std::vector<signed int> pilot_modulation_;
std::vector<std::vector<gr_complex>> sampled_code_data_;
std::vector<std::vector<gr_complex>> sampled_code_pilot_;
std::vector<gr_complex> complex_phase_;
float BW_BB_;
unsigned int work_counter_{};
std::random_device r;
std::uniform_int_distribution<int> uniform_dist;
std::normal_distribution<float> normal_dist;
unsigned int fs_in_;
unsigned int num_sats_;
unsigned int vector_length_;
bool data_flag_;
bool noise_flag_;
};
#endif // GNSS_SDR_SIGNAL_GENERATOR_C_H