GLOCNavAlm.cpp
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 #include "GLOCNavAlm.hpp"
40 #include "TimeString.hpp"
41 #include "YDSTime.hpp"
42 #include "GLOCNavEph.hpp"
43 #include "DebugTrace.hpp"
44 
45 using namespace std;
46 
47 namespace gnsstk
48 {
49  const PZ90Ellipsoid GLOCNavAlm::ell;
50  const double GLOCNavAlm::GM = ell.gm_km();
51  const double GLOCNavAlm::ae = ell.a_km();
56  const double GLOCNavAlm::iav = 64.8;
57  const double GLOCNavAlm::Tav = 40544.0;
58  const double GLOCNavAlm::J20 = 1082625.75e-9;
59 
60 
61  GLOCNavAlm ::
62  GLOCNavAlm()
63  : orbitType(GLOCOrbitType::Unknown),
64  numSVs(0),
65  aoa(0),
66  NA(0),
67  statusReg(0),
68  satType(GLOCSatType::Unknown),
69  tau(std::numeric_limits<double>::quiet_NaN()),
70  lambda(std::numeric_limits<double>::quiet_NaN()),
71  tLambda(std::numeric_limits<double>::quiet_NaN()),
72  deltai(std::numeric_limits<double>::quiet_NaN()),
73  ecc(std::numeric_limits<double>::quiet_NaN()),
74  omega(std::numeric_limits<double>::quiet_NaN()),
75  deltaT(std::numeric_limits<double>::quiet_NaN()),
76  deltaTdot(std::numeric_limits<double>::quiet_NaN())
77  {
79  msgLenSec = 3.0;
80  }
81 
82 
83  bool GLOCNavAlm ::
84  validate() const
85  {
87  return true;
88  }
89 
90 
91  bool GLOCNavAlm ::
92  getXvt(const CommonTime& when, Xvt& xvt, const ObsID& oid)
93  {
94  xvt = math.getXvt(*this, when);
98  return true;
99  }
100 
101 
104  {
105  return timeStamp + 3.0;
106  }
107 
108 
109  void GLOCNavAlm ::
111  {
113  // There is no stated fit interval or period of validity
114  // for almanac data. However, it is generally safe to
115  // assume that the data should not be used before
116  // the transmit time.
121  }
122 
123 
124  void GLOCNavAlm ::
125  dump(std::ostream& s, DumpDetail dl) const
126  {
127  if (dl == DumpDetail::Terse)
128  {
129  dumpTerse(s);
130  return;
131  }
132  ios::fmtflags oldFlags = s.flags();
133 
134  s.setf(ios::fixed, ios::floatfield);
135  s.setf(ios::right, ios::adjustfield);
136  s.setf(ios::uppercase);
137  s.precision(0);
138  s.fill(' ');
139 
140  s << "**************************************************************"
141  << endl
142  << " GLONASS ORB/CLK (NON-IMMEDIATE) PARAMETERS" << endl << endl
143  << "SAT : " << signal.sat << endl << " "
144  << StringUtils::asString(satType) << endl << endl;
145 
146  // the rest is full details, so just return if Full is not asked for.
147  if (dl != DumpDetail::Full)
148  {
149  return;
150  }
151 
152  s.setf(ios::fixed, ios::floatfield);
153  s.setf(ios::right, ios::adjustfield);
154  s.setf(ios::uppercase);
155  s.precision(0);
156  s.fill(' ');
157 
159  header.dumpStrOverhead("STR20:", s);
160 
161  string tform("%02m/%02d/%Y %03j %02H:%02M:%02S %7.0s %P");
162  s << endl
163  << " TIMES OF INTEREST" << endl << endl
164  << " MM/DD/YYYY DOY HH:MM:SS SOD\n"
165  << "Begin Valid: " << printTime(beginFit,tform) << endl
166  << "Orbit Epoch: "
167  << printTime(Toa,tform) << endl
168  << "End Valid: " << printTime(endFit,tform) << endl
169  << endl
170  << " ORBIT PARAMETERS" << endl << endl
171  << "Parameter Value" << endl;
172 
173  s.setf(ios::scientific, ios::floatfield);
174  s.setf(ios::right, ios::adjustfield);
175  s.setf(ios::uppercase);
176  s.precision(6);
177  s.fill(' ');
178 
179  s << "orbit " << setw(16) << (int)orbitType << " "
180  << StringUtils::asString(orbitType) << endl
181  << "alm SVs " << setw(16) << numSVs << endl
182  << "alm age " << setw(16) << aoa << " days" << endl
183  << "status " << setw(16) << hex << showbase << nouppercase
184  << statusReg << dec << noshowbase;
185  if (statusReg & 0x10)
186  {
187  s << " L1";
188  }
189  if (statusReg & 0x08)
190  {
191  s << " L2";
192  }
193  if (statusReg & 0x04)
194  {
195  s << " L3";
196  }
197  s << endl
198  << "tau " << setw(16) << tau << " sec" << endl
199  << "lambda " << setw(16) << lambda << " rad" << endl
200  << "di " << setw(16) << deltai << " rad" << endl
201  << "e " << setw(16) << ecc << " dimensionless" << endl
202  << "omega " << setw(16) << omega << " rad" << endl
203  << "tLambda " << setw(16) << tLambda << " seconds" << endl
204  << "dT " << setw(16) << deltaT << " sec/orbit" << endl
205  << "dTd " << setw(16) << deltaTdot << " sec/orbit**2" << endl;
206 
207  s.setf(ios::fixed, ios::floatfield);
208  s.precision(0);
209  s << "Transmit SV " << setw(16) << signal.xmitSat << endl;
210 
211  s.flags(oldFlags);
212  }
213 
214 
215  void GLOCNavAlm ::
216  dumpTerse(std::ostream& s) const
217  {
218  string tform2("%02m/%02d/%4Y %03j %02H:%02M:%02S");
219  stringstream ss;
220  ss << " " << setw(2) << signal.sat.id << " ";
221  ss << printTime(beginFit,tform2);
222  ss << " ! ";
223  ss << printTime(Toa,tform2) << " ! ";
224  if (!header.svUnhealthy)
225  {
226  ss << " op";
227  }
228  else
229  {
230  ss << "bad";
231  }
232  ss << " " << setw(2) << signal.sat.id;
233  s << ss.str();
234  }
235 
236 
239  : a(std::numeric_limits<double>::quiet_NaN()),
240  h(std::numeric_limits<double>::quiet_NaN()),
241  l(std::numeric_limits<double>::quiet_NaN()),
242  lambda(std::numeric_limits<double>::quiet_NaN()),
243  omega(std::numeric_limits<double>::quiet_NaN()),
244  i(std::numeric_limits<double>::quiet_NaN()),
245  Lk(std::numeric_limits<double>::quiet_NaN())
246  {
247  }
248 
249 
251  operator-(const Perturbations& right) const
252  {
253  Perturbations rv;
254  rv.a = a-right.a;
255  rv.h = h-right.h;
256  rv.l = l-right.l;
257  rv.lambda = lambda-right.lambda;
258  rv.omega = omega-right.omega;
259  rv.i = i-right.i;
260  rv.Lk = Lk-right.Lk;
261  return rv;
262  }
263 
264 
267  : Deltatpr(std::numeric_limits<double>::quiet_NaN()),
268  W(-1),
269  Tdr(std::numeric_limits<double>::quiet_NaN()),
270  n(std::numeric_limits<double>::quiet_NaN()),
271  E0(std::numeric_limits<double>::quiet_NaN()),
272  L1(std::numeric_limits<double>::quiet_NaN()),
273  L(std::numeric_limits<double>::quiet_NaN()),
274  B(std::numeric_limits<double>::quiet_NaN())
275  {
276  }
277 
278 
281  : p(std::numeric_limits<double>::quiet_NaN())
282  {
283  }
284 
285 
288  : p(std::numeric_limits<double>::quiet_NaN()),
289  E(std::numeric_limits<double>::quiet_NaN()),
290  epsilon(std::numeric_limits<double>::quiet_NaN()),
291  nu(std::numeric_limits<double>::quiet_NaN()),
292  u(std::numeric_limits<double>::quiet_NaN()),
293  r(std::numeric_limits<double>::quiet_NaN()),
294  vu(std::numeric_limits<double>::quiet_NaN()),
295  vr(std::numeric_limits<double>::quiet_NaN())
296  {
297  }
298 }
YDSTime.hpp
gnsstk::GLOCNavAlm::Perturbations::Perturbations
Perturbations()
Initialize everything to NaN.
Definition: GLOCNavAlm.cpp:238
gnsstk::GLOCNavAlm::Perturbations::lambda
double lambda
longitude of ascending node
Definition: GLOCNavAlm.hpp:167
gnsstk::NavData::msgLenSec
double msgLenSec
Definition: NavData.hpp:199
gnsstk::SatID::id
int id
Satellite identifier, e.g. PRN.
Definition: SatID.hpp:154
gnsstk::GLOCNavAlm::numSVs
unsigned numSVs
Number of SVs in complete almanac (NS).
Definition: GLOCNavAlm.hpp:131
gnsstk::GLOCNavHeader::dumpStrOverhead
void dumpStrOverhead(const std::string &label, std::ostream &s) const
Definition: GLOCNavHeader.cpp:81
gnsstk::GLOCNavAlm::orbitType
GLOCOrbitType orbitType
Orbit type.
Definition: GLOCNavAlm.hpp:130
gnsstk::GLOCNavAlm::Uncorrected::Uncorrected
Uncorrected()
Initialize data to NaN.
Definition: GLOCNavAlm.cpp:280
L1
gnsstk::Matrix< double > L1
Definition: Matrix_LUDecomp_T.cpp:46
gnsstk::GLOCNavHeader::dumpOverHeader
static void dumpOverHeader(std::ostream &s)
Definition: GLOCNavHeader.cpp:72
gnsstk::GLOCNavAlm::NumberCruncher::NumberCruncher
NumberCruncher()
Definition: GLOCNavAlm.cpp:266
gnsstk::Xvt::Healthy
@ Healthy
Satellite is healthy, PVT valid.
Definition: Xvt.hpp:96
gnsstk::GLOCNavData::header
GLOCNavHeader header
Common data.
Definition: GLOCNavData.hpp:65
gnsstk::GLOCNavHeader::dataInvalid
bool dataInvalid
Data validity flag (lj, false=valid).
Definition: GLOCNavHeader.hpp:88
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::GLOCNavAlm::deltaT
double deltaT
Draconic orbital period offset.
Definition: GLOCNavAlm.hpp:142
gnsstk::GLOCNavAlm::getUserTime
CommonTime getUserTime() const override
Definition: GLOCNavAlm.cpp:103
example5.oid
oid
Definition: example5.py:29
gnsstk::NavFit::endFit
CommonTime endFit
Time at end of fit interval.
Definition: NavFit.hpp:55
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::CommonTime::setTimeSystem
CommonTime & setTimeSystem(TimeSystem timeSystem)
Definition: CommonTime.hpp:195
gnsstk::GLOCNavAlm::tLambda
double tLambda
Instant in Moscow time when passing lambda.
Definition: GLOCNavAlm.hpp:138
gnsstk::GLOCNavAlm::statusReg
unsigned statusReg
Status register (SRA 5.3.2.7).
Definition: GLOCNavAlm.hpp:134
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk::GLOCNavAlm::aoa
unsigned aoa
Age of almanac (EA).
Definition: GLOCNavAlm.hpp:132
GLOCNavEph.hpp
gnsstk::GLOCNavAlm::Perturbations::omega
double omega
argument of perigee
Definition: GLOCNavAlm.hpp:168
gnsstk::GLOCNavAlm::Perturbations::l
double l
Quasi-Keplerian thing (true longitude?).
Definition: GLOCNavAlm.hpp:166
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::IonexStoreStrategy::Unknown
@ Unknown
Unknown or uninitialized stategy value.
gnsstk::GLOCNavAlm::Perturbations::operator-
Perturbations operator-(const Perturbations &right) const
Allow this class to be differenced.
Definition: GLOCNavAlm.cpp:251
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
GLOCNavAlm.hpp
gnsstk::CommonTime::END_OF_TIME
static const GNSSTK_EXPORT CommonTime END_OF_TIME
latest representable CommonTime
Definition: CommonTime.hpp:104
gnsstk::GLOCNavAlm::satType
GLOCSatType satType
What satellite j is and what it transmits.
Definition: GLOCNavAlm.hpp:135
gnsstk::GLOCSatType
GLOCSatType
Values for Word M in the ephemeris (immediate) and almanac data.
Definition: GLOCSatType.hpp:47
gnsstk::GLOCNavAlm::deltai
double deltai
Inclination offset from 64.8 degrees (semicirc).
Definition: GLOCNavAlm.hpp:139
gnsstk::GLOCNavAlm::validate
bool validate() const override
Definition: GLOCNavAlm.cpp:84
gnsstk::GLOCNavAlm::NumberCruncher::getXvt
Xvt getXvt(const GLOCNavAlm &alm, const gnsstk::CommonTime &toi)
Definition: GLOCNavAlmNumberCruncher.hpp:50
gnsstk::GLOCNavAlm::ecc
double ecc
Eccentricity at tlambdaA.
Definition: GLOCNavAlm.hpp:140
gnsstk::ObsID
Definition: ObsID.hpp:82
gnsstk::NavSatelliteID::sat
SatID sat
ID of satellite to which the nav data applies.
Definition: NavSatelliteID.hpp:169
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::GLOCNavAlm::fixFit
void fixFit()
Definition: GLOCNavAlm.cpp:110
gnsstk::GLOCNavAlm::tau
double tau
Time correction from L3OCd to GLONASS.
Definition: GLOCNavAlm.hpp:136
gnsstk::NavFit::beginFit
CommonTime beginFit
Time at beginning of fit interval.
Definition: NavFit.hpp:54
gnsstk::Xvt
Definition: Xvt.hpp:60
gnsstk::GLOCNavAlm::Toa
CommonTime Toa
Reference time for almanac.
Definition: GLOCNavAlm.hpp:129
gnsstk::GLOCNavAlm::Perturbations::Lk
double Lk
Mean longitude.
Definition: GLOCNavAlm.hpp:170
gnsstk::GLOCNavAlm::Perturbations::a
double a
Semi-major axis.
Definition: GLOCNavAlm.hpp:164
gnsstk::DumpDetail::Full
@ Full
Include all detailed information.
gnsstk::Xvt::health
HealthStatus health
Health status of satellite at ref time.
Definition: Xvt.hpp:157
gnsstk::DumpDetail::Terse
@ Terse
Aptly named, multiple lines of output with no labels.
gnsstk::GLOCNavHeader::svUnhealthy
bool svUnhealthy
Health flag (Hj, false=healthy).
Definition: GLOCNavHeader.hpp:87
gnsstk::CommonTime::getTimeSystem
TimeSystem getTimeSystem() const
Obtain time system info (enum).
Definition: CommonTime.cpp:288
gnsstk::DumpDetail
DumpDetail
Specify level of detail for dump output.
Definition: DumpDetail.hpp:51
gnsstk::printTime
std::string printTime(const CommonTime &t, const std::string &fmt)
Definition: TimeString.cpp:64
DebugTrace.hpp
std
Definition: Angle.hpp:142
gnsstk::GLOCNavAlm::dumpTerse
void dumpTerse(std::ostream &s) const
Definition: GLOCNavAlm.cpp:216
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::dump
void dump(std::ostream &s, DumpDetail dl) const override
Definition: GLOCNavAlm.cpp:125
DEBUGTRACE_FUNCTION
#define DEBUGTRACE_FUNCTION()
Definition: DebugTrace.hpp:117
gnsstk::GLOCNavAlm::deltaTdot
double deltaTdot
Draconic orbital period rate.
Definition: GLOCNavAlm.hpp:143
gnsstk::GLOCNavAlm::getXvt
bool getXvt(const CommonTime &when, Xvt &xvt, const ObsID &=ObsID()) override
Definition: GLOCNavAlm.cpp:92
gnsstk::GLOCNavAlm::math
NumberCruncher math
Retain as much computed data as possible.
Definition: GLOCNavAlm.hpp:389
gnsstk::GLOCNavAlm::Corrected::Corrected
Corrected()
Initialize data to NaN.
Definition: GLOCNavAlm.cpp:287
gnsstk::GLOCNavAlm::Perturbations
Definition: GLOCNavAlm.hpp:148
gnsstk::GLOCNavAlm::Perturbations::i
double i
inclination
Definition: GLOCNavAlm.hpp:169
gnsstk::GLOCOrbitType
GLOCOrbitType
Values for Word TO in the almanac data.
Definition: GLOCOrbitType.hpp:47
gnsstk::NavSatelliteID::xmitSat
SatID xmitSat
ID of the satellite transmitting the nav data.
Definition: NavSatelliteID.hpp:170
gnsstk::GLOCNavAlm::Perturbations::h
double h
Quasi-Keplerian thing (true latitude?).
Definition: GLOCNavAlm.hpp:165
gnsstk::Xvt::Unhealthy
@ Unhealthy
Sat is marked unhealthy, do not use PVT.
Definition: Xvt.hpp:94
example6.numSVs
numSVs
Definition: example6.py:112
TimeString.hpp
gnsstk::NavMessageType::Almanac
@ Almanac
Low-precision orbits for other than the transmitting SV.


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