GNU Radio's SATELLITES Package
doppler_correction.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2022-2023,2025 Daniel Estevez <daniel@destevez.net>.
4  *
5  * This file is part of gr-satellites
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  */
9 
10 #ifndef INCLUDED_SATELLITES_DOPPLER_CORRECTION_H
11 #define INCLUDED_SATELLITES_DOPPLER_CORRECTION_H
12 
13 #include <gnuradio/sync_block.h>
14 #include <satellites/api.h>
15 #include <string>
16 
17 namespace gr {
18 namespace satellites {
19 
20 /*!
21  * \brief Performs Doppler correction using a frequency vs. time file
22  * \ingroup satellites
23  *
24  * \details
25  * The Doppler Correction block uses a text file listing frequency vs. time to
26  * perform Doppler correction on its input signal. The same block can be used
27  * for Doppler simulation by inverting the frequency values in the input file or
28  * by taking the complex conjugate of the output of the block.
29  *
30  * The text file should contain lines with a timestamp and a frequency separated
31  * by a space. The timestamps are given in seconds, and typically consist of
32  * UNIX time. The t0 parameter in the block constructor gives the starting time,
33  * which is the timestamp corresponding to the first sample processed by the
34  * block. As long as the timestamps in the file and this timestamp are
35  * consistent, the block will work correctly. The frequencies are given in Hz.
36  *
37  * The block can also use time tags such as those generated by the UHD Source
38  * block to update its internal timestamp. In this case the timestamps in the
39  * file should use UNIX seconds, since the UHD timestamps also use UNIX
40  * seconds. When using UHD time tags, the t0 parameter can be left as 0.
41  *
42  * The Doppler correction block interpolates the frequency linearly between each
43  * pair of entries in the text file, and generates a correction with continuous
44  * phase.
45  *
46  * An optional time synchronization tag functionality is provided, mainly
47  * intended for uplink Doppler correction of burst transmissions. When this tag
48  * is received, the Doppler correction block sets its internal time to the
49  * current UNIX time of the PC. Usually, the "packet_len" tag at the beginning
50  * of the burst is used as time synchronization tag.
51  */
52 class SATELLITES_API doppler_correction : virtual public gr::sync_block
53 {
54 public:
55  typedef boost::shared_ptr<doppler_correction> sptr;
56 
57  /*!
58  * \brief Build the Doppler Correction block.
59  *
60  * \param filename Path of the text file describing the Doppler data
61  * \param samp_rate Sample rate
62  * \param t0 Timestamp corresponding to the first sample
63  * \param timesync_tag Tag used to trigger time synchronization to the current PC
64  * clock
65  */
66  static sptr make(const char* filename,
67  double samp_rate,
68  double t0,
69  const char* timesync_tag = "");
70 
71  /*!
72  * \brief Sets the current time.
73  *
74  * \param t Tiemstamp corresponding to the current time.
75  */
76  virtual void set_time(double t) = 0;
77 
78  /*!
79  * \brief Returns the current time.
80  */
81  virtual double time() = 0;
82 
83  /*!
84  * \brief Returns the current frequency in Hz.
85  */
86  virtual double frequency() = 0;
87 };
88 
89 } // namespace satellites
90 } // namespace gr
91 
92 #endif /* INCLUDED_SATELLITES_DOPPLER_CORRECTION_H */
#define SATELLITES_API
Definition: api.h:31
Performs Doppler correction using a frequency vs. time file.
Definition: doppler_correction.h:53
static sptr make(const char *filename, double samp_rate, double t0, const char *timesync_tag="")
Build the Doppler Correction block.
boost::shared_ptr< doppler_correction > sptr
Definition: doppler_correction.h:55
virtual double time()=0
Returns the current time.
virtual double frequency()=0
Returns the current frequency in Hz.
virtual void set_time(double t)=0
Sets the current time.
data_t t[NROOTS+1]
Definition: lib/libfec/decode_rs.h:83
Definition: ax100_decode.h:17