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