GLOFNavEph_T.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 <math.h>
40 #include "TestUtil.hpp"
41 #include "GLOFNavEph.hpp"
42 #include "CivilTime.hpp"
43 #include "YDSTime.hpp"
44 
45 namespace gnsstk
46 {
47  std::ostream& operator<<(std::ostream& s, GLOFNavPCode e)
48  {
49  s << StringUtils::asString(e);
50  return s;
51  }
52 }
53 
54 
56 {
57 public:
58  unsigned constructorTest();
59  unsigned validateTest();
60  unsigned getXvtTest();
61  unsigned getUserTimeTest();
62  unsigned fixFitTest();
63 };
64 
65 
66 unsigned GLOFNavEph_T ::
68 {
69  TUDEF("GLOFNavEph", "GLOFNavEph()");
72  TUASSERTE(gnsstk::CommonTime, exp, uut.ref);
75  TUASSERTE(size_t, 3, uut.pos.size());
76  TUASSERTFE(0, uut.pos[0]);
77  TUASSERTFE(0, uut.pos[1]);
78  TUASSERTFE(0, uut.pos[2]);
79  TUASSERTE(size_t, 3, uut.vel.size());
80  TUASSERTFE(0, uut.vel[0]);
81  TUASSERTFE(0, uut.vel[1]);
82  TUASSERTFE(0, uut.vel[2]);
83  TUASSERTE(size_t, 3, uut.acc.size());
84  TUASSERTFE(0, uut.acc[0]);
85  TUASSERTFE(0, uut.acc[1]);
86  TUASSERTFE(0, uut.acc[2]);
87  TUASSERT(isnan(uut.clkBias));
88  TUASSERT(isnan(uut.freqBias));
89  TUASSERTE(unsigned, (uint8_t)-1, uut.healthBits);
90  TUASSERTE(unsigned, -1, uut.tb);
91  TUASSERTE(unsigned, -1, uut.P1);
92  TUASSERTE(unsigned, -1, uut.P2);
93  TUASSERTE(unsigned, -1, uut.P3);
94  TUASSERTE(unsigned, -1, uut.P4);
95  TUASSERTE(unsigned, -1, uut.interval);
97  uut.opStatus);
98  TUASSERT(isnan(uut.tauDelta));
99  TUASSERTE(unsigned, -1, uut.aod);
100  TUASSERTE(unsigned, -1, uut.accIndex);
101  TUASSERTE(unsigned, -1, uut.dayCount);
102  TUASSERTE(gnsstk::CommonTime, exp, uut.Toe);
103  TUASSERTFE(60.0, uut.step);
104  TURETURN();
105 }
106 
107 
108 unsigned GLOFNavEph_T ::
110 {
111  TUDEF("GLOFNavEph", "validate()");
112  gnsstk::GLOFNavEph uut;
114  TUASSERTE(bool, true, uut.validate());
115  TURETURN();
116 }
117 
118 
119 unsigned GLOFNavEph_T ::
121 {
122  TUDEF("GLOFNavEph", "getXvt()");
123  gnsstk::GLOFNavEph uut;
124  gnsstk::Xvt xvt, exp1, exp2;
126  // This data was probably originally obtained by setting uut to
127  // values obtained from the broadcast data and running it
128  // through the now deprecated GloEphemeris class, but that
129  // algorithm has errors that have been corrected in GLOFNavEph
130  // so we've changed the truth values since then to those
131  // generated by GLOFNavEph which has been more thoroughly tested
132  // by comparing it against a precise ephemeris.
133  uut.pos[0] = 15553.6342773;
134  uut.pos[1] = -19901.1298828;
135  uut.pos[2] = 3553.3354492200001;
136  uut.vel[0] = -0.41938495636000001;
137  uut.vel[1] = 0.32419204711900002;
138  uut.vel[2] = 3.5266609191899998;
139  uut.acc[0] = 0;
140  uut.acc[1] = -9.3132257461499999e-10;
141  uut.acc[2] = -1.86264514923e-09;
142  uut.clkBias = 5.0653703510800001e-05;
143  uut.freqBias = 1.8189894035500001e-12;
145  exp1.x[0] = 15553634.277300000191;
146  exp1.x[1] = -19901129.882800001651;
147  exp1.x[2] = 3553335.4492200003006;
148  exp1.v[0] = -419.38495635999998967;
149  exp1.v[1] = 324.19204711899999438;
150  exp1.v[2] = 3526.6609191899997313;
151  exp1.clkbias = -5.0643837887362983528e-05;
152  exp1.clkdrift = 1.8189894035500000529e-12;
153  exp1.relcorr = 9.8656234370161929753e-09;
154  exp2.x[0] = 15414234.528740599751;
155  exp2.x[1] = -19781497.388851653785;
156  exp2.x[2] = 4628091.6837431369349;
157  exp2.v[0] = -490.60674449595484248;
158  exp2.v[1] = 458.15034225547964297;
159  exp2.v[2] = 3496.5690971077401628;
160  exp2.clkbias = -5.0644406829568993625e-05;
161  exp2.clkdrift = 1.8189894035500000529e-12;
162  exp2.relcorr = 9.8532919671748554905e-09;
163  // m_day=2454010, m_msod=900000, GLO
164  uut.Toe = gnsstk::CivilTime(2006, 10, 1, 0, 15, 0, gnsstk::TimeSystem::GLO);
165  TUASSERTE(bool, true, uut.getXvt(uut.Toe, xvt));
167  gnsstk::Xvt::HealthStatus::Healthy, xvt.health);
168  for (unsigned i = 0; i < 3; i++)
169  {
170  TUASSERTFE(exp1.x[i], xvt.x[i]);
171  TUASSERTFE(exp1.v[i], xvt.v[i]);
172  }
173  TUASSERTFE(exp1.clkbias, xvt.clkbias);
174  TUASSERTFE(exp1.clkdrift, xvt.clkdrift);
175  TUASSERTFE(exp1.relcorr, xvt.relcorr);
176  TUASSERTE(gnsstk::RefFrame,expRF,xvt.frame);
177  // same ephemeris, orbit 306 seconds in the future of Toe
178  TUASSERTE(bool, true, uut.getXvt(uut.Toe + 306, xvt));
180  gnsstk::Xvt::HealthStatus::Healthy, xvt.health);
181  for (unsigned i = 0; i < 3; i++)
182  {
183  TUASSERTFE(exp2.x[i], xvt.x[i]);
184  TUASSERTFE(exp2.v[i], xvt.v[i]);
185  }
186  TUASSERTFE(exp2.clkbias, xvt.clkbias);
187  TUASSERTFE(exp2.clkdrift, xvt.clkdrift);
188  TUASSERTFE(exp2.relcorr, xvt.relcorr);
189  TUASSERTE(gnsstk::RefFrame,expRF,xvt.frame);
190  TURETURN();
191 }
192 
193 
194 unsigned GLOFNavEph_T ::
196 {
197  TUDEF("GLOFNavEph", "getUserTime()");
198  gnsstk::GLOFNavEph uut;
199  uut.timeStamp = gnsstk::CivilTime(2021,5,19,0,1,13,gnsstk::TimeSystem::GLO);
200  uut.xmit2 = gnsstk::CivilTime(2021,5,19,0,1,19,gnsstk::TimeSystem::GLO);
201  uut.xmit3 = gnsstk::CivilTime(2021,5,19,0,1,15,gnsstk::TimeSystem::GLO);
202  uut.xmit4 = gnsstk::CivilTime(2021,5,19,0,1,17,gnsstk::TimeSystem::GLO);
203  gnsstk::CommonTime exp(gnsstk::CivilTime(2021,5,19,0,1,21,
206  TURETURN();
207 }
208 
209 
210 unsigned GLOFNavEph_T ::
212 {
213  TUDEF("GLOFNavEph", "fixFit()");
214  gnsstk::GLOFNavEph uut;
215  // test each of the possible interval values (0, 30, 45, 60)
217  bexp(gnsstk::CivilTime(2021,5,19,0,1,13,gnsstk::TimeSystem::GLO)),
218  eexp0(gnsstk::CivilTime(2021,5,19,0,45,30,gnsstk::TimeSystem::GLO)),
219  eexp30(gnsstk::CivilTime(2021,5,19,0,45,30,gnsstk::TimeSystem::GLO)),
220  eexp45(gnsstk::CivilTime(2021,5,19,0,53,0,gnsstk::TimeSystem::GLO)),
221  eexp60(gnsstk::CivilTime(2021,5,19,1,0,30,gnsstk::TimeSystem::GLO));
222  uut.timeStamp = gnsstk::CivilTime(2021,5,19,0,1,13,gnsstk::TimeSystem::GLO);
223  uut.Toe = gnsstk::CivilTime(2021,5,19,0,30,0,gnsstk::TimeSystem::GLO);
224  uut.interval = 0;
225  TUCATCH(uut.fixFit());
227  TUASSERTE(gnsstk::CommonTime, eexp0, uut.endFit);
228  uut.interval = 30;
229  TUCATCH(uut.fixFit());
231  TUASSERTE(gnsstk::CommonTime, eexp30, uut.endFit);
232  uut.interval = 45;
233  TUCATCH(uut.fixFit());
235  TUASSERTE(gnsstk::CommonTime, eexp45, uut.endFit);
236  uut.interval = 60;
237  TUCATCH(uut.fixFit());
239  TUASSERTE(gnsstk::CommonTime, eexp60, uut.endFit);
240  TURETURN();
241 }
242 
243 
244 int main()
245 {
246  GLOFNavEph_T testClass;
247  unsigned errorTotal = 0;
248 
249  errorTotal += testClass.constructorTest();
250  errorTotal += testClass.validateTest();
251  errorTotal += testClass.getXvtTest();
252  errorTotal += testClass.getUserTimeTest();
253  errorTotal += testClass.fixFitTest();
254 
255  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
256  << std::endl;
257 
258  return errorTotal;
259 }
GLOFNavEph_T::getXvtTest
unsigned getXvtTest()
Definition: GLOFNavEph_T.cpp:120
YDSTime.hpp
GLOFNavEph_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: GLOFNavEph_T.cpp:195
gnsstk::GLOFNavEph::xmit3
CommonTime xmit3
Transmit time for string 3.
Definition: GLOFNavEph.hpp:113
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
gnsstk::GLOFNavEph
Definition: GLOFNavEph.hpp:51
gnsstk::GLOFNavEph::getUserTime
CommonTime getUserTime() const override
Definition: GLOFNavEph.cpp:177
gnsstk::GLOFNavData::health
SVHealth health
SV health status.
Definition: GLOFNavData.hpp:71
gnsstk::Triple::size
size_t size(void) const
Return the size of this object.
Definition: Triple.hpp:240
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::GLOFNavEph::Toe
CommonTime Toe
Definition: GLOFNavEph.hpp:132
main
int main()
Definition: GLOFNavEph_T.cpp:244
gnsstk::GLOFNavEph::dayCount
unsigned dayCount
Days since Jan 1 of most recent leap year (N_T).
Definition: GLOFNavEph.hpp:131
gnsstk::Xvt::frame
RefFrame frame
reference frame of this data
Definition: Xvt.hpp:156
gnsstk::GLOFNavEph::pos
Triple pos
Satellite position at tb in km.
Definition: GLOFNavEph.hpp:115
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::Xvt::v
Triple v
satellite velocity in ECEF Cartesian, meters/second
Definition: Xvt.hpp:152
gnsstk::GLOFNavEph::opStatus
GLOFNavPCode opStatus
Operational status flag.
Definition: GLOFNavEph.hpp:127
gnsstk::RefFrame
Definition: RefFrame.hpp:53
gnsstk::GLOFNavEph::xmit4
CommonTime xmit4
Transmit time for string 4.
Definition: GLOFNavEph.hpp:114
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::Xvt::relcorr
double relcorr
relativity correction (standard 2R.V/c^2 term), seconds
Definition: Xvt.hpp:155
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
gnsstk::GLOFNavEph::vel
Triple vel
Satellite velocity at tb in km/s.
Definition: GLOFNavEph.hpp:116
gnsstk::GLOFNavPCode::Unknown
@ Unknown
Unknown/Uninitialized value.
gnsstk::Xvt::x
Triple x
Sat position ECEF Cartesian (X,Y,Z) meters.
Definition: Xvt.hpp:151
gnsstk::GLOFNavEph::tauDelta
double tauDelta
Inter-frequency bias.
Definition: GLOFNavEph.hpp:128
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
GLOFNavEph_T
Definition: GLOFNavEph_T.cpp:55
TestUtil.hpp
gnsstk::SVHealth::Healthy
@ Healthy
Satellite is in a healthy and useable state.
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
gnsstk::GLOFNavEph::P4
unsigned P4
Flag 1=ephemeris present/uploaded. 0=nope.
Definition: GLOFNavEph.hpp:125
gnsstk::GLOFNavEph::aod
unsigned aod
Age of data in days (E_n).
Definition: GLOFNavEph.hpp:129
gnsstk::GLOFNavEph::P1
unsigned P1
Flag for interval between adjacent t_b.
Definition: GLOFNavEph.hpp:122
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::Xvt::clkdrift
double clkdrift
satellite clock drift in seconds/second
Definition: Xvt.hpp:154
gnsstk::NavFit::beginFit
CommonTime beginFit
Time at beginning of fit interval.
Definition: NavFit.hpp:54
gnsstk::Xvt
Definition: Xvt.hpp:60
CivilTime.hpp
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::GLOFNavEph::accIndex
unsigned accIndex
User accuracy index (F_T).
Definition: GLOFNavEph.hpp:130
gnsstk::TimeSystem::GLO
@ GLO
GLONASS system time (aka UTC(SU))
gnsstk::GLOFNavEph::P2
unsigned P2
Flag of oddness (=1) or evenness (=0) of t_b.
Definition: GLOFNavEph.hpp:123
gnsstk::GLOFNavData::xmit2
CommonTime xmit2
Transmit time for string 2 (eph) or odd string.
Definition: GLOFNavData.hpp:67
gnsstk::Xvt::HealthStatus
HealthStatus
Definition: Xvt.hpp:87
gnsstk::Xvt::health
HealthStatus health
Health status of satellite at ref time.
Definition: Xvt.hpp:157
gnsstk::CivilTime
Definition: CivilTime.hpp:55
gnsstk::GLOFNavEph::ref
CommonTime ref
Reference time (t_k) for this ephemeris.
Definition: GLOFNavEph.hpp:112
gnsstk::GLOFNavEph::clkBias
double clkBias
Satellite clock bias in sec (tau_n).
Definition: GLOFNavEph.hpp:118
gnsstk::GLOFNavEph::fixFit
void fixFit()
Definition: GLOFNavEph.cpp:185
gnsstk::GLOFNavEph::interval
unsigned interval
P1 interval (minutes, see PNBGLOFNavDataFactory).
Definition: GLOFNavEph.hpp:126
gnsstk::GLOFNavEph::step
double step
Integration step for Runge-Kutta algorithm (1 second by default)
Definition: GLOFNavEph.hpp:134
gnsstk::RefFrameRlz::PZ90KGS
@ PZ90KGS
PZ90 the "original".
GLOFNavEph.hpp
gnsstk::GLOFNavEph::P3
unsigned P3
Flag 1=5 almanac sats in frame, 0=4 almanac sats.
Definition: GLOFNavEph.hpp:124
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
GLOFNavEph_T::validateTest
unsigned validateTest()
Definition: GLOFNavEph_T.cpp:109
gnsstk::GLOFNavEph::acc
Triple acc
Satellite acceleration at tb in km/s**2.
Definition: GLOFNavEph.hpp:117
GLOFNavEph_T::fixFitTest
unsigned fixFitTest()
Definition: GLOFNavEph_T.cpp:211
gnsstk::Xvt::clkbias
double clkbias
Sat clock correction in seconds.
Definition: Xvt.hpp:153
gnsstk::GLOFNavEph::tb
unsigned tb
Epoch index with Moscow day.
Definition: GLOFNavEph.hpp:121
gnsstk::GLOFNavEph::healthBits
uint8_t healthBits
The 3-bit B_n value (look at bit 2 not 0 or 1).
Definition: GLOFNavEph.hpp:120
gnsstk::GLOFNavEph::freqBias
double freqBias
Satellite relative frequency bias (gamma_n).
Definition: GLOFNavEph.hpp:119
gnsstk::GLOFNavEph::getXvt
bool getXvt(const CommonTime &when, Xvt &xvt, const ObsID &=ObsID()) override
Definition: GLOFNavEph.cpp:79
gnsstk::GLOFNavEph::validate
bool validate() const override
Definition: GLOFNavEph.cpp:71
GLOFNavEph_T::constructorTest
unsigned constructorTest()
Definition: GLOFNavEph_T.cpp:67
gnsstk::GLOFNavPCode
GLOFNavPCode
Definition: GLOFNavPCode.hpp:56


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