1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-12 11:10:33 +00:00

Adding experimental input filter Pulse Blanking algorithm implementation

This commit is contained in:
Javier Arribas 2017-02-21 11:35:18 +01:00
parent d6e5c2c329
commit d5656e65a8
9 changed files with 582 additions and 1 deletions

View File

@ -0,0 +1,183 @@
; Default configuration file
; You can define your own receiver and invoke it by doing
; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf
;
[GNSS-SDR]
;######### GLOBAL OPTIONS ##################
;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz].
GNSS-SDR.internal_fs_hz=2000000
;######### CONTROL_THREAD CONFIG ############
ControlThread.wait_for_flowgraph=false
;######### SUPL RRLP GPS assistance configuration #####
GNSS-SDR.SUPL_gps_enabled=false
GNSS-SDR.SUPL_read_gps_assistance_xml=true
GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com
GNSS-SDR.SUPL_gps_ephemeris_port=7275
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
GNSS-SDR.SUPL_gps_acquisition_port=7275
GNSS-SDR.SUPL_MCC=244
GNSS-SDR.SUPL_MNS=5
GNSS-SDR.SUPL_LAC=0x59e2
GNSS-SDR.SUPL_CI=0x31b0
;######### SIGNAL_SOURCE CONFIG ############
;#implementation: Use [File_Signal_Source] or [UHD_Signal_Source] or [GN3S_Signal_Source] (experimental)
SignalSource.implementation=File_Signal_Source
;#When left empty, the device discovery routines will search all vailable transports on the system (ethernet, usb...)
SignalSource.device_address=192.168.50.2
;#filename: path to file with the captured GNSS signal samples to be processed
SignalSource.filename=/home/javier/signals/signal_source_int.dat
;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
SignalSource.item_type=gr_complex
;#sampling_frequency: Original Signal sampling frequency in [Hz]
SignalSource.sampling_frequency=2000000
;#freq: RF front-end center frequency in [Hz]
SignalSource.freq=1575420000
;#gain: Front-end Gain in [dB]
SignalSource.gain=40
;#subdevice: UHD subdevice specification (for USRP1 use A:0 or B:0)
SignalSource.subdevice=A:0
;#samples: Number of samples to be processed. Notice that 0 indicates the entire file.
SignalSource.samples=0
;#repeat: Repeat the processing file. Disable this option in this version
SignalSource.repeat=false
;#dump: Dump the Signal source data to a file. Disable this option in this version
SignalSource.dump=false
SignalSource.dump_filename=dump.dat
;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing.
; it helps to not overload the CPU, but the processing time will be longer.
SignalSource.enable_throttle_control=false
;######### SIGNAL_CONDITIONER CONFIG ############
;## It holds blocks to change data type, filter and resample input data.
;#implementation: Use [Pass_Through] or [Signal_Conditioner]
;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks
;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks
SignalConditioner.implementation=Signal_Conditioner
;######### INPUT_FILTER CONFIG ############
;## Filter the input data. Can be combined with frequency translation for IF signals
;#[Pass_Through] disables this block
InputFilter.implementation=Pulse_Blanking_Filter
InputFilter.Pfa=0.001
;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version.
InputFilter.input_item_type=gr_complex
;#outut_item_type: Type and resolution for output filtered signal samples. Use only gr_complex in this version.
InputFilter.output_item_type=gr_complex
;#dump: Dump the filtered data to a file.
InputFilter.dump=false
;#dump_filename: Log path and filename.
InputFilter.dump_filename=../data/input_filter.dat
;######### CHANNELS GLOBAL CONFIG ############
Channels_1C.count=8
Channels.in_acquisition=8
Channel.signal=1C
;######### ACQUISITION GLOBAL CONFIG ############
Acquisition_1C.dump=false
Acquisition_1C.dump_filename=./acq_dump.dat
Acquisition_1C.item_type=gr_complex
Acquisition_1C.if=0
Acquisition_1C.sampled_ms=1
Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition
;#use_CFAR_algorithm: If enabled, acquisition estimates the input signal power to implement CFAR detection algorithms
;#notice that this affects the Acquisition threshold range!
Acquisition_1C.use_CFAR_algorithm=false;
;#threshold: Acquisition threshold
Acquisition_1C.threshold=20
;Acquisition_1C.pfa=0.01
Acquisition_1C.doppler_max=5000
Acquisition_1C.doppler_step=250
;######### TRACKING GPS CONFIG ############
;#implementation: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking] or [GPS_L1_CA_DLL_PLL_C_Aid_Tracking] or [GPS_L1_CA_TCP_CONNECTOR_Tracking] or [Galileo_E1_DLL_PLL_VEML_Tracking]
Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_C_Aid_Tracking
;#item_type: Type and resolution for each of the signal samples. Use only [gr_complex] in this version.
Tracking_1C.item_type=gr_complex
;#sampling_frequency: Signal Intermediate Frequency in [Hz]
Tracking_1C.if=0
;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false]
Tracking_1C.dump=true
;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number.
Tracking_1C.dump_filename=../data/epl_tracking_ch_
;# Extended correlation after telemetry bit synchronization
;# Valid values are: [1,2,4,5,10,20] (integer divisors of the GPS L1 CA bit period (20 ms) )
;# Longer integration period require more stable front-end LO
Tracking_1C.extend_correlation_ms=10
;#pll_bw_hz: PLL loop filter bandwidth [Hz]
Tracking_1C.pll_bw_hz=35;
Tracking_1C.pll_bw_narrow_hz=30;
;#dll_bw_hz: DLL loop filter bandwidth [Hz]
Tracking_1C.dll_bw_hz=2.0;
Tracking_1C.dll_bw_narrow_hz=1.5;
;#fll_bw_hz: FLL loop filter bandwidth [Hz]
Tracking_1C.fll_bw_hz=2.0;
;#order: PLL/DLL loop filter order [2] or [3]
Tracking_1C.order=3;
;######### TELEMETRY DECODER GPS CONFIG ############
TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder
TelemetryDecoder_1C.dump=false
TelemetryDecoder_1C.decimation_factor=1;
;######### OBSERVABLES CONFIG ############
Observables.implementation=GPS_L1_CA_Observables
Observables.averaging_depth=1
Observables.dump=true
Observables.dump_filename=./observables.dat
;######### PVT CONFIG ############
PVT.implementation=GPS_L1_CA_PVT
PVT.averaging_depth=100
PVT.flag_averaging=false
PVT.output_rate_ms=1
PVT.display_rate_ms=100
PVT.dump_filename=./PVT
PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea;
PVT.flag_nmea_tty_port=false;
PVT.nmea_dump_devname=/dev/pts/4
PVT.flag_rtcm_server=false
PVT.flag_rtcm_tty_port=false
PVT.rtcm_dump_devname=/dev/pts/1
PVT.dump=false

View File

@ -20,6 +20,7 @@ set(INPUT_FILTER_ADAPTER_SOURCES
fir_filter.cc
freq_xlating_fir_filter.cc
beamformer_filter.cc
pulse_blanking_filter.cc
)
include_directories(

View File

@ -0,0 +1,147 @@
/*!
* \file pulse_blanking_filter.cc
* \brief Instantiates the GNSS-SDR pulse blanking filter
* \author Javier Arribas 2017
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "pulse_blanking_filter.h"
#include <boost/lexical_cast.hpp>
#include <gnuradio/blocks/file_sink.h>
#include <glog/logging.h>
#include "configuration_interface.h"
using google::LogMessage;
PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, std::string role,
unsigned int in_streams, unsigned int out_streams) :
config_(configuration), role_(role), in_streams_(in_streams),
out_streams_(out_streams)
{
size_t item_size;
std::string default_input_item_type = "gr_complex";
std::string default_output_item_type = "gr_complex";
std::string default_dump_filename = "../data/input_filter.dat";
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);
dump_ = config_->property(role_ + ".dump", false);
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
double Pfa = config_->property(role_ + ".Pfa", 0.001);
if (input_item_type_.compare("gr_complex") == 0)
{
item_size = sizeof(gr_complex); //output
input_size_ = sizeof(gr_complex); //input
pulse_blanking_cc_ = make_pulse_blanking_cc(Pfa);
}
else
{
LOG(ERROR) << " Unknown input filter input/output item type conversion";
item_size = sizeof(gr_complex); //avoids uninitialization
input_size_ = sizeof(gr_complex); //avoids uninitialization
}
if (dump_)
{
DLOG(INFO) << "Dumping output into file " << dump_filename_;
std::cout << "Dumping output into file " << dump_filename_ << std::endl;
file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str());
}
}
PulseBlankingFilter::~PulseBlankingFilter()
{}
void PulseBlankingFilter::connect(gr::top_block_sptr top_block)
{
if (input_item_type_.compare("gr_complex") == 0)
{
if (dump_)
{
top_block->connect(pulse_blanking_cc_, 0, file_sink_, 0);
}
}
else
{
LOG(ERROR) << " Unknown input filter input/output item type conversion";
}
}
void PulseBlankingFilter::disconnect(gr::top_block_sptr top_block)
{
if (input_item_type_.compare("gr_complex") == 0)
{
if (dump_)
{
top_block->disconnect(pulse_blanking_cc_, 0, file_sink_, 0);
}
}
else
{
LOG(ERROR) << " Unknown input filter input/output item type conversion";
}
}
gr::basic_block_sptr PulseBlankingFilter::get_left_block()
{
if (input_item_type_.compare("gr_complex") == 0)
{
return pulse_blanking_cc_;
}
else
{
return nullptr;
LOG(ERROR) << " Unknown input filter input/output item type conversion";
}
}
gr::basic_block_sptr PulseBlankingFilter::get_right_block()
{
if (input_item_type_.compare("gr_complex") == 0)
{
return pulse_blanking_cc_;
}
else
{
return nullptr;
LOG(ERROR) << " Unknown input filter input/output item type conversion";
}
}

View File

@ -0,0 +1,88 @@
/*!
* \file pulse_blanking_filter.h
* \brief Instantiates the GNSS-SDR pulse blanking filter
* \author Javier Arribas 2017
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_PULSE_BLANKING_FILTER_H_
#define GNSS_SDR_PULSE_BLANKING_FILTER_H_
#include <string>
#include <vector>
#include <gnuradio/blocks/file_sink.h>
#include "gnss_block_interface.h"
#include "pulse_blanking_cc.h"
class ConfigurationInterface;
/*!
* \brief TODO
*/
class PulseBlankingFilter: public GNSSBlockInterface
{
public:
PulseBlankingFilter(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams,
unsigned int out_streams);
virtual ~PulseBlankingFilter();
std::string role()
{
return role_;
}
//! Returns "Pulse_Blanking_Filter"
std::string implementation()
{
return "Pulse_Blanking_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:
ConfigurationInterface* config_;
bool dump_;
std::string dump_filename_;
std::string input_item_type_;
size_t input_size_;
std::string output_item_type_;
double intermediate_freq_;
double sampling_freq_;
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_;
};
#endif // GNSS_SDR_PULSE_BLANKING_FILTER_H_

View File

@ -19,6 +19,7 @@
set(INPUT_FILTER_GR_BLOCKS_SOURCES
beamformer.cc
pulse_blanking_cc.cc
)
include_directories(
@ -27,10 +28,11 @@ include_directories(
${GFlags_INCLUDE_DIRS}
${GNURADIO_RUNTIME_INCLUDE_DIRS}
${GNURADIO_BLOCKS_INCLUDE_DIRS}
${VOLK_GNSSSDR_INCLUDE_DIRS}
)
file(GLOB INPUT_FILTER_GR_BLOCKS_HEADERS "*.h")
list(SORT INPUT_FILTER_GR_BLOCKS_HEADERS)
add_library(input_filter_gr_blocks ${INPUT_FILTER_GR_BLOCKS_SOURCES} ${INPUT_FILTER_GR_BLOCKS_HEADERS})
source_group(Headers FILES ${INPUT_FILTER_GR_BLOCKS_HEADERS})
target_link_libraries(input_filter_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES})
target_link_libraries(input_filter_gr_blocks ${GNURADIO_RUNTIME_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES})

View File

@ -0,0 +1,91 @@
/*!
* \file pulse_blanking_cc.cc
* \brief Implements a simple pulse blanking algorithm
* \author Javier Arribas (jarribas(at)cttc.es)
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "pulse_blanking_cc.h"
#include <gnuradio/io_signature.h>
#include <math.h>
#include <volk/volk.h>
#include <volk_gnsssdr/volk_gnsssdr.h>
#include <complex>
pulse_blanking_cc_sptr make_pulse_blanking_cc(double Pfa)
{
return pulse_blanking_cc_sptr(new pulse_blanking_cc(Pfa));
}
pulse_blanking_cc::pulse_blanking_cc(double Pfa) : gr::block("pulse_blanking_cc",
gr::io_signature::make (1, 1, sizeof(gr_complex)),
gr::io_signature::make (1, 1, sizeof(gr_complex)))
{
const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
set_alignment(std::max(1, alignment_multiple));
d_Pfa=Pfa;
}
int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
// 1- (optional) Compute the input signal power estimation
//float mean;
//float stddev;
//volk_32f_stddev_and_mean_32f_x2(&stddev, &mean, in, noutput_items);
float* magnitude;
magnitude = static_cast<float*>(volk_gnsssdr_malloc(noutput_items * sizeof(float), volk_gnsssdr_get_alignment()));
float var;
volk_32fc_magnitude_squared_32f(magnitude, in, noutput_items);
volk_32f_accumulator_s32f(&var, magnitude, noutput_items);
var /= static_cast<float>(noutput_items);
// compute pulse blanking threshold (Paper Borio 2016)
float Th=sqrt(-2.0*var*log10(d_Pfa));
//apply the pulse blanking
//todo: write volk kernel to optimize the blanking
memcpy(out,in, sizeof(gr_complex)*noutput_items);
for (int n=0;n<noutput_items;n++)
{
if (std::abs(out[n])>Th)
{
out[n]=gr_complex(0,0);
}
}
consume_each(noutput_items);
return noutput_items;
}

View File

@ -0,0 +1,59 @@
/*!
* \file pulse_blanking_cc.h
* \brief Implements a simple pulse blanking algorithm
* \author Javier Arribas (jarribas(at)cttc.es)
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_PULSE_BLANKING_H_
#define GNSS_SDR_PULSE_BLANKING_H_
#include <boost/shared_ptr.hpp>
#include <gnuradio/block.h>
class pulse_blanking_cc;
typedef boost::shared_ptr<pulse_blanking_cc> pulse_blanking_cc_sptr;
pulse_blanking_cc_sptr make_pulse_blanking_cc(double Pfa);
/*!
* \brief This class adapts a short (16-bits) interleaved sample stream
* into a std::complex<short> stream
*/
class pulse_blanking_cc : public gr::block
{
private:
friend pulse_blanking_cc_sptr pulse_blanking_cc(double Pfa);
double d_Pfa;
public:
pulse_blanking_cc(double Pfa);
int general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
};
#endif

View File

@ -402,6 +402,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
}
// UPDATE INTEGRATION TIME
CURRENT_INTEGRATION_TIME_S = static_cast<double>(d_extend_correlation_ms) * GPS_L1_CA_CODE_PERIOD;
d_code_loop_filter.set_pdi(CURRENT_INTEGRATION_TIME_S);
enable_dll_pll = true;
}
else
@ -438,6 +439,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
// perform basic (1ms) correlation
// UPDATE INTEGRATION TIME
CURRENT_INTEGRATION_TIME_S = static_cast<double>(d_correlation_length_samples) / static_cast<double>(d_fs_in);
d_code_loop_filter.set_pdi(CURRENT_INTEGRATION_TIME_S);
enable_dll_pll = true;
}
}

View File

@ -64,6 +64,7 @@
#include "fir_filter.h"
#include "freq_xlating_fir_filter.h"
#include "beamformer_filter.h"
#include "pulse_blanking_filter.h"
#include "gps_l1_ca_pcps_acquisition.h"
#include "gps_l2_m_pcps_acquisition.h"
#include "gps_l1_ca_pcps_multithread_acquisition.h"
@ -876,6 +877,13 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
out_streams));
block = std::move(block_);
}
else if (implementation.compare("Pulse_Blanking_Filter") == 0)
{
std::unique_ptr<GNSSBlockInterface> block_(new PulseBlankingFilter(configuration.get(), role, in_streams,
out_streams));
block = std::move(block_);
}
// RESAMPLER -------------------------------------------------------------------
else if (implementation.compare("Direct_Resampler") == 0)