GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
tracking_loop_filter.h
Go to the documentation of this file.
1/*!
2 * \file tracking_loop_filter.h
3 * \brief Generic 1st to 3rd order loop filter implementation
4 * \author Cillian O'Driscoll, 2015. cillian.odriscoll(at)gmail.com
5 *
6 * Class implementing a generic 1st, 2nd or 3rd order loop filter. Based
7 * on the bilinear transform of the standard Wiener filter.
8 *
9 * -----------------------------------------------------------------------------
10 *
11 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12 * This file is part of GNSS-SDR.
13 *
14 * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
15 * SPDX-License-Identifier: GPL-3.0-or-later
16 *
17 * -----------------------------------------------------------------------------
18 */
19
20#ifndef GNSS_SDR_TRACKING_LOOP_FILTER_H
21#define GNSS_SDR_TRACKING_LOOP_FILTER_H
22
23#include <vector>
24
25/** \addtogroup Tracking
26 * \{ */
27/** \addtogroup Tracking_libs
28 * \{ */
29
30
31/*!
32 * \brief This class implements a generic 1st, 2nd or 3rd order loop filter
33 *
34 */
35class Tracking_loop_filter
36{
37public:
38 Tracking_loop_filter();
39 ~Tracking_loop_filter() = default;
40
41 Tracking_loop_filter(float update_interval, float noise_bandwidth,
42 int loop_order = 2,
43 bool include_last_integrator = false);
44
45 Tracking_loop_filter(Tracking_loop_filter&&) = default; //!< Move operator
46 Tracking_loop_filter& operator=(Tracking_loop_filter&& /*other*/) = default; //!< Move assignment operator
47
48 float get_noise_bandwidth() const;
49 float get_update_interval() const;
50 bool get_include_last_integrator() const;
51 int get_order() const;
52
53 void set_noise_bandwidth(float noise_bandwidth);
54 void set_update_interval(float update_interval);
55 void set_include_last_integrator(bool include_last_integrator);
56 void set_order(int loop_order);
57
58 void initialize(float initial_output = 0.0);
59 float apply(float current_input);
60
61private:
62 // Compute the filter coefficients:
63 void update_coefficients();
64
65 // Store the last inputs and outputs:
66 std::vector<float> d_inputs;
67 std::vector<float> d_outputs;
68
69 // Store the filter coefficients:
70 std::vector<float> d_input_coefficients;
71 std::vector<float> d_output_coefficients;
72
73 // The noise bandwidth (in Hz)
74 // Note this is an approximation only valid when the product of this
75 // number and the update interval (T) is small.
76 float d_noise_bandwidth;
77
78 // Loop update interval
79 float d_update_interval;
80
81 // The loop order:
82 int d_loop_order;
83
84 // The current index in the i/o arrays:
85 int d_current_index;
86
87 // Should the last integrator be included?
88 bool d_include_last_integrator;
89};
90
91
92/** \} */
93/** \} */
94#endif // GNSS_SDR_TRACKING_LOOP_FILTER_H
Tracking_loop_filter(Tracking_loop_filter &&)=default
Move operator.
Tracking_loop_filter & operator=(Tracking_loop_filter &&)=default
Move assignment operator.