Commit e2426243 authored by Manolis Surligas's avatar Manolis Surligas

Create doppler shift correction block

parent 4e1be5ee
......@@ -28,5 +28,6 @@ install(FILES
satnogs_ax25_decoder_b.xml
satnogs_udp_msg_source.xml
satnogs_debug_msg_source.xml
satnogs_tcp_rigctl_msg_source.xml DESTINATION share/gnuradio/grc/blocks
satnogs_tcp_rigctl_msg_source.xml
satnogs_doppler_correction_cc.xml DESTINATION share/gnuradio/grc/blocks
)
<?xml version="1.0"?>
<block>
<name>doppler_correction_cc</name>
<key>satnogs_doppler_correction_cc</key>
<category>satnogs</category>
<import>import satnogs</import>
<make>satnogs.doppler_correction_cc($target_freq)</make>
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
Sub-nodes:
* name
* key (makes the value accessible as $keyname, e.g. in the make node)
* type -->
<param>
<name>...</name>
<key>...</key>
<type>...</type>
</param>
<!-- Make one 'sink' node per input. Sub-nodes:
* name (an identifier for the GUI)
* type
* vlen
* optional (set to 1 for optional inputs) -->
<sink>
<name>in</name>
<type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
</sink>
<!-- Make one 'source' node per output. Sub-nodes:
* name (an identifier for the GUI)
* type
* vlen
* optional (set to 1 for optional inputs) -->
<source>
<name>out</name>
<type><!-- e.g. int, float, complex, byte, short, xxx_vector, ...--></type>
</source>
</block>
......@@ -40,5 +40,6 @@ install(FILES
udp_msg_source.h
debug_msg_source.h
tc_tm.h
tcp_rigctl_msg_source.h DESTINATION include/satnogs
tcp_rigctl_msg_source.h
doppler_correction_cc.h DESTINATION include/satnogs
)
/* -*- 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_DOPPLER_CORRECTION_CC_H
#define INCLUDED_SATNOGS_DOPPLER_CORRECTION_CC_H
#include <satnogs/api.h>
#include <gnuradio/sync_block.h>
namespace gr
{
namespace satnogs
{
/*!
* \brief This block corrects the doppler effect between the ground
* station and the satellite. It takes the imput stream in baseband
* and applies proper corrections to keep the carrier at the desired
* frequency. To achieve that it uses messages containing the absolute
* predicted frequency of the satellite from software like Gpredict.
*
* \ingroup satnogs
*
*/
class SATNOGS_API doppler_correction_cc : virtual public gr::sync_block
{
public:
typedef boost::shared_ptr<doppler_correction_cc> sptr;
/*!
* The doppler correction block. The input is the complex signal at
* baseband as it comes from the SDR device. The message input \p freq
* received periodically messages containing the predicted absolute
* frequency of the satellite at the moment of the
* @param target_freq the absolute frequency of the satellite
* @param sampling_rate the sampling rate of the signal
* @param corrections_per_sec the number of the corrections every second
* that the block should perform
*/
static sptr
make (double target_freq, double sampling_rate,
size_t corrections_per_sec = 1000);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_DOPPLER_CORRECTION_CC_H */
......@@ -37,7 +37,8 @@ list(APPEND satnogs_sources
ax25_decoder_b_impl.cc
udp_msg_source_impl.cc
debug_msg_source_impl.cc
tcp_rigctl_msg_source_impl.cc )
tcp_rigctl_msg_source_impl.cc
doppler_correction_cc_impl.cc )
set(satnogs_sources "${satnogs_sources}" PARENT_SCOPE)
if(NOT satnogs_sources)
......
/* -*- 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 "doppler_correction_cc_impl.h"
namespace gr
{
namespace satnogs
{
doppler_correction_cc::sptr
doppler_correction_cc::make (double target_freq, double sampling_rate,
size_t corrections_per_sec)
{
return gnuradio::get_initial_sptr (
new doppler_correction_cc_impl (target_freq, sampling_rate,
corrections_per_sec));
}
/*
* The private constructor
*/
doppler_correction_cc_impl::doppler_correction_cc_impl (
double target_freq, double sampling_rate, size_t corrections_per_sec) :
gr::sync_block ("doppler_correction_cc",
gr::io_signature::make (1, 1, sizeof(gr_complex)),
gr::io_signature::make (1, 1, sizeof(gr_complex))),
d_target_freq (target_freq),
d_samp_rate (sampling_rate),
d_update_period (sampling_rate / (double) corrections_per_sec),
d_freq_diff (0.0)
{
message_port_register_in (pmt::mp ("freq"));
/*
* Set the maximum number of samples to be equivalent of half a second.
* With this way we are sure that at least one frequency message
* per second will be processed.
*/
set_max_noutput_items (d_samp_rate / 2.0);
}
/*
* Our virtual destructor.
*/
doppler_correction_cc_impl::~doppler_correction_cc_impl ()
{
}
int
doppler_correction_cc_impl::work (int noutput_items,
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];
return noutput_items;
}
} /* 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_DOPPLER_CORRECTION_CC_IMPL_H
#define INCLUDED_SATNOGS_DOPPLER_CORRECTION_CC_IMPL_H
#include <satnogs/doppler_correction_cc.h>
namespace gr
{
namespace satnogs
{
class doppler_correction_cc_impl : public doppler_correction_cc
{
private:
const double d_target_freq;
const double d_samp_rate;
const double d_update_period;
double d_freq_diff;
public:
doppler_correction_cc_impl (double target_freq, double sampling_rate,
size_t corrections_per_sec);
~doppler_correction_cc_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);
};
} // namespace satnogs
} // namespace gr
#endif /* INCLUDED_SATNOGS_DOPPLER_CORRECTION_CC_IMPL_H */
......@@ -22,6 +22,7 @@
#include "satnogs/udp_msg_source.h"
#include "satnogs/debug_msg_source.h"
#include "satnogs/tcp_rigctl_msg_source.h"
#include "satnogs/doppler_correction_cc.h"
%}
......@@ -50,3 +51,5 @@ GR_SWIG_BLOCK_MAGIC2(satnogs, udp_msg_source);
GR_SWIG_BLOCK_MAGIC2(satnogs, debug_msg_source);
%include "satnogs/tcp_rigctl_msg_source.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, tcp_rigctl_msg_source);
%include "satnogs/doppler_correction_cc.h"
GR_SWIG_BLOCK_MAGIC2(satnogs, doppler_correction_cc);
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