Commit 0287bc66 authored by Manolis Surligas's avatar Manolis Surligas

Remove obsolete match filtering block

parent 909ae9da
......@@ -33,7 +33,6 @@ list(APPEND enabled_blocks
satnogs_multi_format_msg_sink.xml
satnogs_ogg_encoder.xml
satnogs_cw_to_symbol.xml
satnogs_sine_matched_filter_ff.xml
satnogs_udp_msg_source.xml
satnogs_tcp_rigctl_msg_source.xml
satnogs_doppler_correction_cc.xml
......
<?xml version="1.0"?>
<block>
<name>Sine Matched filter</name>
<key>satnogs_sine_matched_filter_ff</key>
<import>import satnogs</import>
<make>satnogs.sine_matched_filter_ff($sampling_rate, $sine_freq, $baud, $compute_energy)</make>
<param>
<name>Sampling Rate</name>
<key>sampling_rate</key>
<type>real</type>
</param>
<param>
<name>Sine Frequency (Hz)</name>
<key>sine_freq</key>
<type>real</type>
</param>
<param>
<name>Baudrate</name>
<key>baud</key>
<type>real</type>
</param>
<param>
<name>Compute Energy</name>
<key>compute_energy</key>
<type>enum</type>
<option>
<name>No</name>
<key>False</key>
</option>
<option>
<name>Yes</name>
<key>True</key>
</option>
</param>
<sink>
<name>freq</name>
<type>message</type>
<optional>1</optional>
</sink>
<sink>
<name>in</name>
<type>float</type>
</sink>
<source>
<name>out</name>
<type>float</type>
</source>
</block>
......@@ -39,7 +39,6 @@ list(APPEND HEADER_FILES
multi_format_msg_sink.h
ogg_encoder.h
cw_to_symbol.h
sine_matched_filter_ff.h
utils.h
udp_msg_source.h
tcp_rigctl_msg_source.h
......
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_SATNOGS_SINE_MATCHED_FILTER_FF_H
#define INCLUDED_SATNOGS_SINE_MATCHED_FILTER_FF_H
#include <satnogs/api.h>
#include <gnuradio/sync_block.h>
namespace gr
{
namespace satnogs
{
/*!
* \brief Matched filter for signals that use sinusoidal transmissions,
* like FSK, AFSK, e.t.c.
*
* \ingroup satnogs
*
*/
class SATNOGS_API sine_matched_filter_ff : virtual public gr::sync_block
{
public:
typedef boost::shared_ptr<sine_matched_filter_ff> sptr;
/*!
* A matched filter that produces the filtered signal or its energy
* @param sampling_rate the sampling rate
* @param sine_freq the frequency of the sine wave
* @param baudrate the Baud-rate (aka symbols-per-second) of the
* telecommunication protocol
* @param compute_energy id set to true the filter computes the energy
* of the filtered signal. Otherwise, the filtered signal itself is
* produced
*/
static sptr
make (double sampling_rate, double sine_freq, double baudrate,
bool compute_energy = false);
virtual void
set_new_freq (double freq) = 0;
virtual void
set_new_freq_locked (double freq) = 0;
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_SINE_MATCHED_FILTER_FF_H */
......@@ -46,7 +46,6 @@ list(APPEND satnogs_sources
multi_format_msg_sink_impl.cc
ogg_encoder_impl.cc
cw_to_symbol_impl.cc
sine_matched_filter_ff_impl.cc
udp_msg_source_impl.cc
tcp_rigctl_msg_source_impl.cc
doppler_correction_cc_impl.cc
......
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include <volk/volk.h>
#include <gnuradio/fxpt_nco.h>
#include "sine_matched_filter_ff_impl.h"
namespace gr {
namespace satnogs {
sine_matched_filter_ff::sptr
sine_matched_filter_ff::make(double sampling_rate, double sine_freq,
double baudrate, bool compute_energy)
{
return gnuradio::get_initial_sptr
(new sine_matched_filter_ff_impl(sampling_rate, sine_freq,
baudrate, compute_energy));
}
/*
* The private constructor
*/
sine_matched_filter_ff_impl::sine_matched_filter_ff_impl(double sampling_rate,
double sine_freq,
double baudrate,
bool compute_energy)
: gr::sync_block("sine_matched_filter_ff",
gr::io_signature::make(1, 1, sizeof(float)),
gr::io_signature::make(1, 1, sizeof(float))),
d_samp_rate(sampling_rate),
d_baud_rate(baudrate),
d_produce_enrg(compute_energy),
d_filter_taps(2 * std::ceil(sampling_rate / baudrate))
{
const int alignment_multiple = volk_get_alignment() / sizeof(float);
set_alignment(std::max(1,alignment_multiple));
set_history(d_filter_taps);
/*
* TODO: Perhaps is better that now phase offset exists at the end
* of the buffer
*/
d_sin_wave = (float *)volk_malloc(d_filter_taps * sizeof(float), 32);
if(!d_sin_wave){
throw std::runtime_error("Could not allocate sine wave buffer");
}
/* Register the input port for frequency change messages */
message_port_register_in(pmt::mp("freq"));
set_msg_handler(pmt::mp("freq"),
boost::bind(&sine_matched_filter_ff_impl::new_freq_msg_handler,
this, _1));
/* Now fill the buffer with the appropriate sine wave */
gr::fxpt_nco nco;
nco.set_freq(2 * M_PI * sine_freq / sampling_rate);
nco.sin(d_sin_wave, d_filter_taps, 1.0);
}
void
sine_matched_filter_ff_impl::new_freq_msg_handler (pmt::pmt_t msg)
{
if (pmt::is_pair (msg)) {
set_new_freq (pmt::to_double (pmt::cdr (msg)));
}
}
/*
* Our virtual destructor.
*/
sine_matched_filter_ff_impl::~sine_matched_filter_ff_impl()
{
volk_free(d_sin_wave);
}
int
sine_matched_filter_ff_impl::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
boost::mutex::scoped_lock lock (d_mutex);
const float *in = (const float *) input_items[0];
float *out = (float *) output_items[0];
for (int i = 0; i < noutput_items; i++) {
volk_32f_x2_dot_prod_32f (out + i, in + i, d_sin_wave, d_filter_taps);
}
if (d_produce_enrg) {
volk_32f_s32f_power_32f (out, out, 2, noutput_items);
}
return noutput_items;
}
void
sine_matched_filter_ff_impl::set_new_freq (double freq)
{
gr::fxpt_nco nco;
nco.set_freq (2 * M_PI * freq / d_samp_rate);
nco.sin (d_sin_wave, d_filter_taps, 1.0);
}
void
sine_matched_filter_ff_impl::set_new_freq_locked (double freq)
{
boost::mutex::scoped_lock lock(d_mutex);
set_new_freq(freq);
}
} /* namespace satnogs */
} /* namespace gr */
/* -*- c++ -*- */
/*
* gr-satnogs: SatNOGS GNU Radio Out-Of-Tree Module
*
* Copyright (C) 2016, Libre Space Foundation <http://librespacefoundation.org/>
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_SATNOGS_SINE_MATCHED_FILTER_FF_IMPL_H
#define INCLUDED_SATNOGS_SINE_MATCHED_FILTER_FF_IMPL_H
#include <satnogs/sine_matched_filter_ff.h>
namespace gr
{
namespace satnogs
{
class sine_matched_filter_ff_impl : public sine_matched_filter_ff
{
private:
/**
* The sampling rate of the signal
*/
const double d_samp_rate;
/**
* The baudrate of the system
*/
const double d_baud_rate;
/**
* If set to true, this block produces the energy of the filtered
* samples, rather the samples themselves
*/
const bool d_produce_enrg;
const size_t d_filter_taps;
float *d_sin_wave;
boost::mutex d_mutex;
void
new_freq_msg_handler (pmt::pmt_t msg);
public:
sine_matched_filter_ff_impl (double sampling_rate, double sine_freq,
double baudrate, bool compute_energy);
~sine_matched_filter_ff_impl ();
// Where all the action really happens
int
work (int noutput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
void
set_new_freq (double freq);
void
set_new_freq_locked (double freq);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_SINE_MATCHED_FILTER_FF_IMPL_H */
......@@ -13,7 +13,6 @@
#include "satnogs/morse_decoder.h"
#include "satnogs/multi_format_msg_sink.h"
#include "satnogs/cw_to_symbol.h"
#include "satnogs/sine_matched_filter_ff.h"
#include "satnogs/udp_msg_source.h"
#include "satnogs/tcp_rigctl_msg_source.h"
#include "satnogs/doppler_correction_cc.h"
......@@ -46,9 +45,6 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, multi_format_msg_sink);
%include "satnogs/cw_to_symbol.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, cw_to_symbol);
%include "satnogs/sine_matched_filter_ff.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, sine_matched_filter_ff);
%include "satnogs/udp_msg_source.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, udp_msg_source);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment