GPSLNavEph_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 "GPSLNavEph.hpp"
40 #include "TestUtil.hpp"
41 #include "GPSWeekSecond.hpp"
42 #include "CivilTime.hpp"
43 
44 namespace gnsstk
45 {
46  std::ostream& operator<<(std::ostream& s, gnsstk::NavMessageType e)
47  {
48  s << StringUtils::asString(e);
49  return s;
50  }
51  std::ostream& operator<<(std::ostream& s, gnsstk::GPSLNavL2Codes e)
52  {
53  s << static_cast<long>(e);
54  return s;
55  }
56 }
57 
59 {
60 public:
62  unsigned constructorTest();
63  unsigned getUserTimeTest();
64  unsigned fixFitTest();
65  unsigned validateTest();
68  unsigned getClassNameTest();
69  unsigned getXvtTest();
70  unsigned svRelativityTest();
71 };
72 
73 
74 unsigned GPSLNavEph_T ::
76 {
77  TUDEF("NavData", "getClassName");
79  TUASSERTE(std::string, "gnsstk::GPSLNavEph", uut.getClassName());
80  TURETURN();
81 }
82 
83 
84 unsigned GPSLNavEph_T ::
86 {
87  TUDEF("GPSLNavEph", "GPSLNavEph");
89  TUASSERTE(uint32_t, 0, obj.pre2);
90  TUASSERTE(uint32_t, 0, obj.pre3);
91  TUASSERTE(uint32_t, 0, obj.tlm2);
92  TUASSERTE(uint32_t, 0, obj.tlm3);
93  TUASSERTE(bool, false, obj.isf2);
94  TUASSERTE(bool, false, obj.isf3);
95  TUASSERTE(uint16_t, 0, obj.iodc);
96  TUASSERTE(uint16_t, 0, obj.iode);
97  TUASSERTE(uint8_t, 0, obj.fitIntFlag);
98  TUASSERTE(uint8_t, 0xff, obj.healthBits);
99  TUASSERTE(uint8_t, 0, obj.uraIndex);
100  TUASSERTFE(0.0, obj.tgd);
101  TUASSERTE(bool, false, obj.asFlag2);
102  TUASSERTE(bool, false, obj.asFlag3);
103  TUASSERTE(bool, false, obj.alert2);
104  TUASSERTE(bool, false, obj.alert3);
106  obj.codesL2);
107  TUASSERTE(bool, false, obj.L2Pdata);
109  obj.signal.messageType);
110  TURETURN();
111 }
112 
113 
114 unsigned GPSLNavEph_T ::
116 {
117  TUDEF("GPSLNavEph", "getUserTime");
118  gnsstk::GPSLNavEph obj;
119  obj.xmitTime = gnsstk::GPSWeekSecond(2100,135.0);
120  obj.xmit2 = gnsstk::GPSWeekSecond(2100,111.0);
121  obj.xmit3 = gnsstk::GPSWeekSecond(2100,147.0);
122  gnsstk::CommonTime exp(gnsstk::GPSWeekSecond(2100,153.0));
124  TURETURN();
125 }
126 
127 
128 unsigned GPSLNavEph_T ::
130 {
131  TUDEF("GPSLNavEph", "fixFit");
132  gnsstk::GPSLNavEph obj;
139  gnsstk::GPSWeekSecond beginExpWS2(2121, 603360), endExpWS2(2122, 7200);
140  gnsstk::CommonTime beginExp2(beginExpWS2), endExp2(endExpWS2);
141  obj.iodc = 0xd;
142  obj.fitIntFlag = 0;
143  obj.Toe = obj.Toc = gnsstk::GPSWeekSecond(2122, 0);
144  obj.xmitTime = gnsstk::GPSWeekSecond(2121,603360);
145  TUCATCH(obj.fixFit());
146  TUASSERTE(gnsstk::CommonTime, beginExp2, obj.beginFit);
147  TUASSERTE(gnsstk::CommonTime, endExp2, obj.endFit);
148  //obj.dump(std::cerr, gnsstk::OrbitDataKepler::Detail::Full);
149  TURETURN();
150 }
151 
152 
153 unsigned GPSLNavEph_T ::
155 {
156  TUDEF("GPSLNavData", "validate");
157  gnsstk::GPSLNavEph obj;
158  TUASSERTE(bool, true, obj.validate());
159  obj.pre = 0x22c; // this is not valid
160  TUASSERTE(bool, false, obj.validate());
161  obj.pre = 0x8b; // this is valid
162  obj.pre2 = 0x22c; // this is not valid
163  TUASSERTE(bool, false, obj.validate());
164  obj.pre2 = 0x8b; // this is valid
165  obj.pre3 = 0x22c; // this is not valid
166  TUASSERTE(bool, false, obj.validate());
167  obj.pre3 = 0x8b; // this is valid (all 3 preambles == 8b)
168  TUASSERTE(bool, true, obj.validate());
169  TURETURN();
170 }
171 
172 
173 unsigned GPSLNavEph_T ::
175 {
176  TUDEF("GPSLNavEph", "getXvt");
177  gnsstk::GPSLNavEph uut;
178  gnsstk::Xvt xvt;
180  uut.xmitTime = gnsstk::GPSWeekSecond(1854, .720000000000e+04);
181  uut.Toe = gnsstk::GPSWeekSecond(1854, .143840000000e+05);
182  uut.Toc = gnsstk::CivilTime(2015,7,19,3,59,44.0,gnsstk::TimeSystem::GPS);
184  gnsstk::CivilTime civ(2015,7,19,2,0,35.0,gnsstk::TimeSystem::GPS);
185  TUASSERT(uut.getXvt(civ, xvt));
187  TUASSERTE(gnsstk::RefFrame,expRF,xvt.frame);
188  TURETURN();
189 }
190 
191 
192 unsigned GPSLNavEph_T ::
194 {
195  TUDEF("GPSLNavEph", "svRelativity");
196  gnsstk::GPSLNavEph uut;
198  gnsstk::CivilTime(2015,7,19,2,0,0.0,gnsstk::TimeSystem::GPS));
199  uut.xmitTime = gnsstk::GPSWeekSecond(1854, .720000000000e+04);
200  uut.Toe = gnsstk::GPSWeekSecond(1854, .143840000000e+05);
201  uut.Toc = gnsstk::CivilTime(2015,7,19,3,59,44.0,gnsstk::TimeSystem::GPS);
203  uut.Cuc = .200793147087e-05;
204  uut.Cus = .823289155960e-05;
205  uut.Crc = .214593750000e+03;
206  uut.Crs = .369375000000e+02;
207  uut.Cic = -.175088644028e-06;
208  uut.Cis = .335276126862e-07;
209  uut.M0 = .218771233916e+01;
210  uut.dn = .511592738462e-08;
211  // dndot
212  uut.ecc = .422249664553e-02;
213  uut.Ahalf =.515360180473e+04;
214  uut.A = uut.Ahalf * uut.Ahalf;
215  // Adot
216  uut.OMEGA0 = -.189462874179e+01;
217  uut.i0 = .946122987969e+00;
218  uut.w = .374892043461e+00;
219  uut.OMEGAdot = -.823034282681e-08;
220  uut.idot = .492877673191e-09;
221  uut.af0 = -.216379296035e-03;
222  uut.af1 = .432009983342e-11;
223  uut.af2 = .000000000000e+00;
224  //uut.iode = .190000000000e+02;
225  // uut.codes = .100000000000e+01
226  //uut.week = .185400000000e+04
227  //uut.l2p = .000000000000e+00
228  //uut.accuracy = .240000000000e+01
229  //uut.tgd = -.107102096081e-07
230  //uut.iodc = .190000000000e+02
231  //uut.fitint = .400000000000e+01;
232  TUASSERTFE(-8.7994080166185110758e-09, uut.svRelativity(ct));
233  TUASSERTFE(-8.8197758101551758427e-09, uut.svRelativity(ct+35));
234  TURETURN();
235 }
236 
237 
238 int main()
239 {
240  GPSLNavEph_T testClass;
241  unsigned errorTotal = 0;
242 
243  errorTotal += testClass.constructorTest();
244  errorTotal += testClass.getUserTimeTest();
245  errorTotal += testClass.fixFitTest();
246  errorTotal += testClass.validateTest();
247  errorTotal += testClass.getXvtTest();
248  errorTotal += testClass.svRelativityTest();
249 
250  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
251  << std::endl;
252 
253  return errorTotal;
254 }
gnsstk::GPSLNavEph::codesL2
GPSLNavL2Codes codesL2
Code on L2 in-phase component.
Definition: GPSLNavEph.hpp:108
GPSLNavEph_T::svRelativityTest
unsigned svRelativityTest()
Definition: GPSLNavEph_T.cpp:193
gnsstk::GPSLNavEph::alert2
bool alert2
Alert flag from SF2 HOW.
Definition: GPSLNavEph.hpp:104
gnsstk::OrbitDataKepler::idot
double idot
Rate of inclination angle (rad/sec)
Definition: OrbitDataKepler.hpp:193
gnsstk::RefFrameRlz::WGS84G1762
@ WGS84G1762
WGS84, GPS week 1762 version.
GPSLNavEph_T
Definition: GPSLNavEph_T.cpp:58
gnsstk::GPSLNavEph::isf2
bool isf2
Integrity status flag from subframe 2.
Definition: GPSLNavEph.hpp:96
gnsstk::GPSLNavEph::xmit3
CommonTime xmit3
Transmit time for subframe 3.
Definition: GPSLNavEph.hpp:91
gnsstk::OrbitDataGPS::getXvt
bool getXvt(const CommonTime &when, Xvt &xvt, const ObsID &oid=ObsID()) override
Definition: OrbitDataGPS.hpp:64
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
gnsstk::OrbitDataKepler::Cis
double Cis
Sine inclination (rad)
Definition: OrbitDataKepler.hpp:180
gnsstk::OrbitDataKepler::A
double A
Semi-major axis (m)
Definition: OrbitDataKepler.hpp:186
gnsstk::OrbitDataKepler::af2
double af2
SV clock drift rate (sec/sec**2)
Definition: OrbitDataKepler.hpp:197
gnsstk::OrbitDataKepler::ecc
double ecc
Eccentricity.
Definition: OrbitDataKepler.hpp:185
gnsstk::Xvt::Healthy
@ Healthy
Satellite is healthy, PVT valid.
Definition: Xvt.hpp:96
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::GPSLNavEph::fitIntFlag
uint8_t fitIntFlag
Fit interval flag from subframe 2.
Definition: GPSLNavEph.hpp:100
gnsstk::OrbitDataKepler::OMEGAdot
double OMEGAdot
Rate of Rt ascension (rad/sec)
Definition: OrbitDataKepler.hpp:192
gnsstk::Xvt::frame
RefFrame frame
reference frame of this data
Definition: Xvt.hpp:156
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::OrbitDataKepler::Cuc
double Cuc
Cosine latitude (rad)
Definition: OrbitDataKepler.hpp:175
gnsstk::GPSLNavEph::L2Pdata
bool L2Pdata
Definition: GPSLNavEph.hpp:114
gnsstk::GPSLNavEph::tlm2
uint32_t tlm2
The TLM message from word 1 of subframe 2.
Definition: GPSLNavEph.hpp:94
gnsstk::OrbitDataKepler::w
double w
Argument of perigee (rad)
Definition: OrbitDataKepler.hpp:191
gnsstk::GPSLNavEph::asFlag2
bool asFlag2
Anti-spoof flag from SF2 HOW.
Definition: GPSLNavEph.hpp:106
gnsstk::OrbitDataKepler::Toe
CommonTime Toe
Orbit epoch.
Definition: OrbitDataKepler.hpp:171
gnsstk::OrbitDataKepler::Crs
double Crs
Sine radius (m)
Definition: OrbitDataKepler.hpp:178
gnsstk::GPSLNavEph::tlm3
uint32_t tlm3
The TLM message from word 1 of subframe 3.
Definition: GPSLNavEph.hpp:95
gnsstk::RefFrame
Definition: RefFrame.hpp:53
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk::GPSLNavEph::uraIndex
uint8_t uraIndex
4-bit URA index from subframe 1, word 3.
Definition: GPSLNavEph.hpp:102
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::GPSLNavEph::validate
bool validate() const override
Definition: GPSLNavEph.cpp:76
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::GPSLNavL2Codes::Invalid1
@ Invalid1
Not a valid broadcast value.
gnsstk::OrbitDataKepler::xmitTime
CommonTime xmitTime
Time of transmission of the start of the data.
Definition: OrbitDataKepler.hpp:170
gnsstk::OrbitDataKepler::M0
double M0
Mean anomaly (rad)
Definition: OrbitDataKepler.hpp:182
gnsstk::GPSLNavL2Codes
GPSLNavL2Codes
Codes on L2 channel, per IS-GPS-200 20.3.3.3.1.2.
Definition: GPSLNavL2Codes.hpp:51
gnsstk::GPSLNavEph::isf3
bool isf3
Integrity status flag from subframe 3.
Definition: GPSLNavEph.hpp:97
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
GPSLNavEph_T::validateTest
unsigned validateTest()
Definition: GPSLNavEph_T.cpp:154
GPSLNavEph_T::getClassNameTest
unsigned getClassNameTest()
Definition: GPSLNavEph_T.cpp:75
TestUtil.hpp
gnsstk::SVHealth::Healthy
@ Healthy
Satellite is in a healthy and useable state.
gnsstk::OrbitDataKepler::Cus
double Cus
Sine latitude (rad)
Definition: OrbitDataKepler.hpp:176
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
gnsstk::GPSLNavEph::healthBits
uint8_t healthBits
6 SV health bits from subframe 1, word 3.
Definition: GPSLNavEph.hpp:101
gnsstk::GPSLNavEph::pre3
uint32_t pre3
The TLM preamble from word 1 of subframe 3.
Definition: GPSLNavEph.hpp:93
GPSLNavEph_T::fixFitTest
unsigned fixFitTest()
Definition: GPSLNavEph_T.cpp:129
gnsstk::OrbitDataKepler::Ahalf
double Ahalf
Square Root of semi-major axis (m**.5)
Definition: OrbitDataKepler.hpp:187
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::GPSLNavEph::xmit2
CommonTime xmit2
Transmit time for subframe 2.
Definition: GPSLNavEph.hpp:90
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::OrbitDataKepler::Toc
CommonTime Toc
Clock epoch.
Definition: OrbitDataKepler.hpp:172
GPSLNavEph_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: GPSLNavEph_T.cpp:85
gnsstk::GPSLNavEph::iode
uint16_t iode
Issue Of Data-Ephemeris.
Definition: GPSLNavEph.hpp:99
gnsstk::GPSLNavEph::fixFit
void fixFit()
Definition: GPSLNavEph.cpp:92
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::OrbitDataKepler::i0
double i0
Inclination (rad)
Definition: OrbitDataKepler.hpp:190
gnsstk::Xvt::HealthStatus
HealthStatus
Definition: Xvt.hpp:87
gnsstk::OrbitDataGPS::svRelativity
double svRelativity(const CommonTime &when) const override
Definition: OrbitDataGPS.hpp:75
gnsstk::Xvt::health
HealthStatus health
Health status of satellite at ref time.
Definition: Xvt.hpp:157
gnsstk::GPSLNavData::pre
uint32_t pre
The TLM preamble from word 1 of the subframe.
Definition: GPSLNavData.hpp:80
gnsstk::OrbitDataKepler::Cic
double Cic
Cosine inclination (rad)
Definition: OrbitDataKepler.hpp:179
gnsstk::CivilTime
Definition: CivilTime.hpp:55
gnsstk::OrbitDataKepler::Crc
double Crc
Cosine radius (m)
Definition: OrbitDataKepler.hpp:177
GPSWeekSecond.hpp
gnsstk::GPSLNavEph::asFlag3
bool asFlag3
Anti-spoof flag from SF3 HOW.
Definition: GPSLNavEph.hpp:107
gnsstk::TimeSystem::GPS
@ GPS
GPS system time.
gnsstk::OrbitDataKepler::af0
double af0
SV clock error (sec)
Definition: OrbitDataKepler.hpp:195
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
gnsstk::NavMessageType::Ephemeris
@ Ephemeris
Precision orbits for the transmitting SV.
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::GPSLNavEph::iodc
uint16_t iodc
Issue Of Data-Clock for the ephemeris.
Definition: GPSLNavEph.hpp:98
gnsstk::GPSLNavEph
Class containing data elements unique to GPS LNav ephemerides.
Definition: GPSLNavEph.hpp:51
GPSLNavEph.hpp
gnsstk::OrbitDataKepler::health
SVHealth health
SV health status.
Definition: OrbitDataKepler.hpp:173
gnsstk::OrbitDataKepler::OMEGA0
double OMEGA0
Longitude of ascending node at weekly epoch (rad)
Definition: OrbitDataKepler.hpp:189
GPSLNavEph_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: GPSLNavEph_T.cpp:115
gnsstk::GPSLNavEph::pre2
uint32_t pre2
The TLM preamble from word 1 of subframe 2.
Definition: GPSLNavEph.hpp:92
gnsstk::OrbitDataKepler::af1
double af1
SV clock drift (sec/sec)
Definition: OrbitDataKepler.hpp:196
gnsstk::NavData::getClassName
virtual std::string getClassName() const
Definition: NavData.cpp:172
gnsstk::GPSLNavEph::tgd
double tgd
Ionospheric group delay in seconds.
Definition: GPSLNavEph.hpp:103
GPSLNavEph_T::getXvtTest
unsigned getXvtTest()
Definition: GPSLNavEph_T.cpp:174
gnsstk::GPSLNavEph::getUserTime
CommonTime getUserTime() const override
Definition: GPSLNavEph.cpp:84
gnsstk::OrbitDataKepler::dn
double dn
Correction to mean motion (rad/sec)
Definition: OrbitDataKepler.hpp:183
gnsstk::GPSLNavEph::alert3
bool alert3
Alert flag from SF3 HOW.
Definition: GPSLNavEph.hpp:105
main
int main()
Definition: GPSLNavEph_T.cpp:238


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