GLOCNavAlmCorrected.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 
26 //==============================================================================
27 //
28 // This software was developed by Applied Research Laboratories at the
29 // University of Texas at Austin, under contract to an agency or agencies
30 // within the U.S. Department of Defense. The U.S. Government retains all
31 // rights to use, duplicate, distribute, disclose, or release this software.
32 //
33 // Pursuant to DoD Directive 523024
34 //
35 // DISTRIBUTION STATEMENT A: This software has been approved for public
36 // release, distribution is unlimited.
37 //
38 //==============================================================================
39 #ifndef GNSSTK_GLOCNAVALMCORRECTED_CPP
40 #define GNSSTK_GLOCNAVALMCORRECTED_CPP
41 
45 #include "DebugTrace.hpp"
46 
47 namespace gnsstk
48 {
49  inline void GLOCNavAlm::Corrected ::
50  setData(double L, const Uncorrected& uncor,
51  const Deltas& delta1, const Deltas& delta2)
52  {
53  a = uncor.geta() + ((delta2.geta() - delta1.geta()) * uncor.geta());
54  h = uncor.geth() + delta2.geth() - delta1.geth();
55  l = uncor.getl() + delta2.getl() - delta1.getl();
56  epsilon = std::sqrt(h*h+l*l);
57  i = uncor.geti() + delta2.geti() - delta1.geti();
58  lambda = uncor.getlambda() + delta2.getlambda() - delta1.getlambda();
59  omega = atan2(h, l);
60  Lk = L + delta2.getLk() - delta1.getLk();
61  setp();
62  setE(L);
63  setnu();
64  setu();
65  setr();
66  setvrvu();
67  }
68 
69 
72  {
73  Xvt rv;
74  double xterm = cos(lambda)*cos(u) - sin(lambda)*sin(u)*cos(i);
75  double yterm = sin(lambda)*cos(u) + cos(lambda)*sin(u)*cos(i);
76  double zterm = sin(u) * sin(i);
77  rv.x[0] = r * xterm;
78  rv.x[1] = r * yterm;
79  rv.x[2] = r * zterm;
80  rv.v[0] = (vr * xterm) -
81  (vu * (cos(lambda)*sin(u) + sin(lambda)*cos(u)*cos(i))) +
82  (omegaE * rv.x[1]);
83  rv.v[1] = (vr * yterm) -
84  (vu * (sin(lambda)*sin(u) - cos(lambda)*cos(u)*cos(i))) -
85  (omegaE * rv.x[0]);
86  rv.v[2] = (vr * zterm) + (vu * cos(u) * sin(i));
87  // change km to m
88  rv.x[0] *= 1000.0;
89  rv.x[1] *= 1000.0;
90  rv.x[2] *= 1000.0;
91  rv.v[0] *= 1000.0;
92  rv.v[1] *= 1000.0;
93  rv.v[2] *= 1000.0;
94  rv.frame = RefFrame(RefFrameSys::PZ90, toi);
95  // clock bias and drift are not available (?).
97  return rv;
98  }
99 
100 
101  inline void GLOCNavAlm::Corrected ::
103  {
104  p = a * (1.0 - epsilon*epsilon);
105  }
106 
107 
108  inline void GLOCNavAlm::Corrected ::
109  setE(double L)
110  {
111  // DEBUGTRACE("Lprime=" << std::scientific << Lk);
112  // DEBUGTRACE("omegaprime=" << std::scientific << omega);
113  double Em1 = Lk - omega;
114  // -9 just to make sure we get at least one iteration
115  double Em = Em1 - 9;
116  unsigned m = 0;
117  while (fabs(Em1-Em) > 1e-9)
118  {
119  Em = Em1;
120  Em1 = Lk - omega + (epsilon * sin(Em));
121  // DEBUGTRACE(std::setw(1) << m << " | " << std::setw(18)
122  // << std::setprecision(12) << std::fixed << Em1);
123  m++;
124  }
125  E = Em1;
126  }
127 
128 
129  inline void GLOCNavAlm::Corrected ::
131  {
132  double nu_top = 1.0 + epsilon;
133  double nu_bot = 1.0 - epsilon;
134  double nu_sqrt = sqrt(nu_top/nu_bot);
135  double nu_tan = tan(E/2.0);
136  double nu_tanned = nu_sqrt * nu_tan;
137  double nu_angle = atan(nu_tanned);
138  nu = 2.0 * nu_angle;
139  }
140 
141 
142  inline void GLOCNavAlm::Corrected ::
144  {
145  u = nu + omega;
146  }
147 
148 
149  inline void GLOCNavAlm::Corrected ::
151  {
152  r = p / (1.0 + (epsilon * cos(nu)));
153  }
154 
155 
156  inline void GLOCNavAlm::Corrected ::
158  {
159  double scale = sqrt(ell.gm_km() / p);
160  vr = scale * epsilon * sin(nu);
161  vu = scale * (1 + (epsilon * cos(nu)));
162  }
163 } // namespace gnsstk
164 
165 #endif //GNSSTK_GLOCNAVALMCORRECTED_CPP
166 
gnsstk::GLOCNavAlm::Corrected::setE
void setE(double L)
Definition: GLOCNavAlmCorrected.hpp:109
gnsstk::RefFrameSys::PZ90
@ PZ90
The reference frame used by Glonass.
gnsstk::GLOCNavAlm::Perturbations::lambda
double lambda
longitude of ascending node
Definition: GLOCNavAlm.hpp:167
gnsstk::GLOCNavAlm::Perturbations::geti
double geti() const
Definition: GLOCNavAlm.hpp:161
gnsstk::Xvt::frame
RefFrame frame
reference frame of this data
Definition: Xvt.hpp:156
gnsstk::GLOCNavAlm::Corrected::setr
void setr()
Definition: GLOCNavAlmCorrected.hpp:150
gnsstk::Xvt::v
Triple v
satellite velocity in ECEF Cartesian, meters/second
Definition: Xvt.hpp:152
gnsstk::GLOCNavAlm::Corrected::setData
void setData(double L, const Uncorrected &uncor, const Deltas &delta1, const Deltas &delta2)
Definition: GLOCNavAlmCorrected.hpp:50
gnsstk::RefFrame
Definition: RefFrame.hpp:53
gnsstk::GLOCNavAlm::Perturbations::omega
double omega
argument of perigee
Definition: GLOCNavAlm.hpp:168
gnsstk::GLOCNavAlm::Corrected::getXvt
Xvt getXvt(const gnsstk::CommonTime &toi)
Definition: GLOCNavAlmCorrected.hpp:71
gnsstk::GLOCNavAlm::Perturbations::l
double l
Quasi-Keplerian thing (true longitude?).
Definition: GLOCNavAlm.hpp:166
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
std::sin
double sin(gnsstk::Angle x)
Definition: Angle.hpp:144
gnsstk::Xvt::relcorr
double relcorr
relativity correction (standard 2R.V/c^2 term), seconds
Definition: Xvt.hpp:155
gnsstk::Xvt::x
Triple x
Sat position ECEF Cartesian (X,Y,Z) meters.
Definition: Xvt.hpp:151
gnsstk::GLOCNavAlm::ell
static const GNSSTK_EXPORT PZ90Ellipsoid ell
Ellipsoid parameters used by GLONASS.
Definition: GLOCNavAlm.hpp:65
gnsstk::PZ90Ellipsoid::gm_km
virtual double gm_km() const noexcept
Definition: PZ90Ellipsoid.hpp:107
gnsstk::GLOCNavAlm::Corrected::setnu
void setnu()
Definition: GLOCNavAlmCorrected.hpp:130
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::GLOCNavAlm::Perturbations::getlambda
double getlambda() const
Definition: GLOCNavAlm.hpp:159
gnsstk::GLOCNavAlm::Corrected::setvrvu
void setvrvu()
Definition: GLOCNavAlmCorrected.hpp:157
gnsstk::Xvt
Definition: Xvt.hpp:60
gnsstk::GLOCNavAlm::Corrected::setp
void setp()
Definition: GLOCNavAlmCorrected.hpp:102
gnsstk::GLOCNavAlm::Perturbations::Lk
double Lk
Mean longitude.
Definition: GLOCNavAlm.hpp:170
std::cos
double cos(gnsstk::Angle x)
Definition: Angle.hpp:146
gnsstk::GLOCNavAlm::Perturbations::a
double a
Semi-major axis.
Definition: GLOCNavAlm.hpp:164
gnsstk::GLOCNavAlm::Perturbations::geth
double geth() const
Definition: GLOCNavAlm.hpp:157
std::tan
double tan(gnsstk::Angle x)
Definition: Angle.hpp:148
gnsstk::GLOCNavAlm::Perturbations::geta
double geta() const
Definition: GLOCNavAlm.hpp:156
DebugTrace.hpp
gnsstk::GLOCNavAlm::Perturbations::getl
double getl() const
Definition: GLOCNavAlm.hpp:158
gnsstk::GLOCNavAlm::Corrected::setu
void setu()
Definition: GLOCNavAlmCorrected.hpp:143
gnsstk::GLOCNavAlm::omega
double omega
Almanac parameter for argument of perigee (semicirc).
Definition: GLOCNavAlm.hpp:141
gnsstk::GLOCNavAlm::lambda
double lambda
Longitude of first ascending node (semicirc).
Definition: GLOCNavAlm.hpp:137
gnsstk::GLOCNavAlm::Deltas
Definition: GLOCNavAlm.hpp:231
gnsstk::GLOCNavAlm::Perturbations::getLk
double getLk() const
Definition: GLOCNavAlm.hpp:162
gnsstk::Xvt::computeRelativityCorrection
virtual double computeRelativityCorrection(void)
Definition: Xvt.cpp:98
gnsstk::GLOCNavAlm::Perturbations::i
double i
inclination
Definition: GLOCNavAlm.hpp:169
gnsstk::GLOCNavAlm::Uncorrected
Definition: GLOCNavAlm.hpp:180
gnsstk::GLOCNavAlm::Perturbations::h
double h
Quasi-Keplerian thing (true latitude?).
Definition: GLOCNavAlm.hpp:165
gnsstk::GLOCNavAlm::omegaE
static constexpr GNSSTK_EXPORT double omegaE
Earth's rotation rate (rad/s).
Definition: GLOCNavAlm.hpp:71
gnsstk::GLOCNavAlm::Corrected::epsilon
double epsilon
epsilon prime, eccentricity.
Definition: GLOCNavAlm.hpp:295


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:39