2016-03-28 17:09:16 +02:00
|
|
|
/* -*- 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>
|
2016-03-30 20:51:19 +02:00
|
|
|
#include <satnogs/freq_drift.h>
|
|
|
|
#include <satnogs/doppler_fit.h>
|
|
|
|
#include <gnuradio/fxpt_nco.h>
|
2016-03-29 21:58:06 +02:00
|
|
|
#include <deque>
|
2016-03-28 17:09:16 +02:00
|
|
|
|
|
|
|
namespace gr
|
|
|
|
{
|
|
|
|
namespace satnogs
|
|
|
|
{
|
|
|
|
|
|
|
|
class doppler_correction_cc_impl : public doppler_correction_cc
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
const double d_target_freq;
|
|
|
|
const double d_samp_rate;
|
2016-03-30 20:51:19 +02:00
|
|
|
const size_t d_update_period;
|
2016-03-29 21:58:06 +02:00
|
|
|
const size_t d_est_thrhld;
|
2016-03-30 20:51:19 +02:00
|
|
|
const size_t d_corrections_per_sec;
|
2016-03-28 17:09:16 +02:00
|
|
|
|
2016-03-30 20:51:19 +02:00
|
|
|
gr::fxpt_nco d_nco;
|
|
|
|
doppler_fit d_doppler_fit_engine;
|
2016-03-28 17:09:16 +02:00
|
|
|
double d_freq_diff;
|
2016-03-29 21:58:06 +02:00
|
|
|
bool d_have_est;
|
|
|
|
size_t d_freq_est_num;
|
2016-03-30 20:51:19 +02:00
|
|
|
size_t d_corrections;
|
|
|
|
size_t d_corrected_samples;
|
|
|
|
std::deque<freq_drift> d_doppler_freqs;
|
|
|
|
double *d_predicted_freqs;
|
|
|
|
gr_complex *d_nco_buff;
|
2016-03-29 21:58:06 +02:00
|
|
|
boost::mutex d_mutex;
|
|
|
|
|
|
|
|
void
|
|
|
|
new_freq (pmt::pmt_t msg);
|
|
|
|
|
|
|
|
void
|
|
|
|
reset (pmt::pmt_t msg);
|
2016-03-28 17:09:16 +02:00
|
|
|
|
|
|
|
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 */
|
|
|
|
|