GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
front_end_cal.h
Go to the documentation of this file.
1 /*!
2  * \file front_end_cal.h
3  * \brief Interface of the Front-end calibration program.
4  * \author Javier Arribas, 2013. jarribas(at)cttc.es
5  *
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_FRONT_END_CAL_H
19 #define GNSS_SDR_FRONT_END_CAL_H
20 
21 #include <armadillo>
22 #include <memory>
23 #include <string>
24 
26 
28 {
29 public:
30  FrontEndCal() = default;
31  ~FrontEndCal() = default;
32 
33  /*!
34  * \brief Sets the configuration data required by get_ephemeris function
35  *
36  */
37  void set_configuration(std::shared_ptr<ConfigurationInterface> configuration);
38 
39  /*!
40  * \brief This function connects to a Secure User Location Protocol (SUPL) server to obtain
41  * the current GPS ephemeris and GPS assistance data. It requires the configuration parameters set by
42  * set_configuration function.
43  *
44  */
45  bool get_ephemeris();
46 
47  /*!
48  * \brief This function estimates the GPS L1 satellite Doppler frequency [Hz] using the following data:
49  * 1- Orbital model from the ephemeris
50  * 2- Approximate GPS Time of Week (TOW)
51  * 3- Approximate receiver Latitude and Longitude (WGS-84)
52  *
53  */
54  double estimate_doppler_from_eph(unsigned int PRN, double tow, double lat, double lon, double height) noexcept(false);
55 
56  /*!
57  * \brief This function models the Elonics E4000 + RTL2832 front-end
58  * Inputs:
59  * f_bb_true_Hz - Ideal output frequency in baseband [Hz]
60  * f_in_bb_meas_Hz - measured output frequency in baseband [Hz]
61  * Outputs:
62  * estimated_fs_Hz - Sampling frequency estimation based on the
63  * measurements and the front-end model
64  * estimated_f_if_bb_Hz - Equivalent bb if frequency estimation based on the
65  * measurements and the front-end model
66  * Front-end TUNER Elonics E4000 + RTL2832 sampler For GPS L1 1575.42 MHz
67  *
68  */
69  void GPS_L1_front_end_model_E4000(double f_bb_true_Hz, double f_bb_meas_Hz, double fs_nominal_hz, double *estimated_fs_Hz, double *estimated_f_if_Hz, double *f_osc_err_ppm);
70 
71 private:
72  std::shared_ptr<ConfigurationInterface> configuration_;
73 
74  /*
75  * LLA2ECEF Convert geodetic coordinates to Earth-centered Earth-fixed
76  * (ECEF) coordinates. P = LLA2ECEF( LLA ) converts an M-by-3 array of geodetic coordinates
77  * (latitude, longitude and altitude), LLA, to an M-by-3 array of ECEF
78  * coordinates, P. LLA is in [degrees degrees meters]. P is in meters.
79  * The default ellipsoid planet is WGS84. Original copyright (c) by Kai Borre.
80  */
81  arma::vec lla2ecef(const arma::vec &lla);
82 
83  /*
84  * GEODETIC2ECEF Convert geodetic to geocentric (ECEF) coordinates
85  * [X, Y, Z] = GEODETIC2ECEF(PHI, LAMBDA, H, ELLIPSOID) converts geodetic
86  * point locations specified by the coordinate arrays PHI (geodetic
87  * latitude in radians), LAMBDA (longitude in radians), and H (ellipsoidal
88  * height) to geocentric Cartesian coordinates X, Y, and Z. The geodetic
89  * coordinates refer to the reference ellipsoid specified by ELLIPSOID (a
90  * row vector with the form [semimajor axis, eccentricity]). H must use
91  * the same units as the semimajor axis; X, Y, and Z will be expressed in
92  * these units also.
93  *
94  * The geocentric Cartesian coordinate system is fixed with respect to the
95  * Earth, with its origin at the center of the ellipsoid and its X-, Y-,
96  * and Z-axes intersecting the surface at the following points:
97  * PHI LAMBDA
98  * X-axis: 0 0 (Equator at the Prime Meridian)
99  * Y-axis: 0 pi/2 (Equator at 90-degrees East
100  * Z-axis: pi/2 0 (North Pole)
101  *
102  * A common synonym is Earth-Centered, Earth-Fixed coordinates, or ECEF.
103  *
104  * See also ECEF2GEODETIC, ECEF2LV, GEODETIC2GEOCENTRICLAT, LV2ECEF.
105  *
106  * Copyright 2004-2009 The MathWorks, Inc.
107  * $Revision: 1.1.6.4 $ $Date: 2009/04/15 23:34:46 $
108  * Reference
109  * ---------
110  * Paul R. Wolf and Bon A. Dewitt, "Elements of Photogrammetry with
111  * Applications in GIS," 3rd Ed., McGraw-Hill, 2000 (Appendix F-3).
112  */
113  arma::vec geodetic2ecef(double phi, double lambda, double h, const arma::vec &ellipsoid);
114 
115  /*
116  * Reads the ephemeris data from an external XML file
117  */
118  bool read_assistance_from_XML();
119 
120  /*
121  * Connects to Secure User Location Protocol (SUPL) server to obtain
122  * the current GPS ephemeris and GPS assistance data.
123  */
124  int Get_SUPL_Assist();
125 
126  const std::string eph_default_xml_filename = "./gps_ephemeris.xml";
127 };
128 
129 #endif
void set_configuration(std::shared_ptr< ConfigurationInterface > configuration)
Sets the configuration data required by get_ephemeris function.
This abstract class represents an interface to configuration parameters.
double estimate_doppler_from_eph(unsigned int PRN, double tow, double lat, double lon, double height) noexcept(false)
This function estimates the GPS L1 satellite Doppler frequency [Hz] using the following data: 1- Orbi...
bool get_ephemeris()
This function connects to a Secure User Location Protocol (SUPL) server to obtain the current GPS eph...
void GPS_L1_front_end_model_E4000(double f_bb_true_Hz, double f_bb_meas_Hz, double fs_nominal_hz, double *estimated_fs_Hz, double *estimated_f_if_Hz, double *f_osc_err_ppm)
This function models the Elonics E4000 + RTL2832 front-end Inputs: f_bb_true_Hz - Ideal output freque...