GPSLNavTimeOffset_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 "GPSLNavTimeOffset.hpp"
40 #include "TestUtil.hpp"
41 #include "GPSWeekSecond.hpp"
42 
43 namespace gnsstk
44 {
45  std::ostream& operator<<(std::ostream& s, gnsstk::NavMessageType e)
46  {
47  s << StringUtils::asString(e);
48  return s;
49  }
50 }
51 
52 
54 {
55 public:
57  unsigned constructorTest();
58  unsigned validateTest();
59  unsigned getUserTimeTest();
60  unsigned getOffsetTest();
61  unsigned getConversionsTest();
62 };
63 
64 
67 {
68  TUDEF("GPSLNavTimeOffset", "GPSLNavTimeOffset");
72  TUASSERTFE(0.0, obj.a0);
73  TUASSERTFE(0.0, obj.a1);
74  TUASSERTFE(0.0, obj.a2);
75  TUASSERTFE(0.0, obj.deltatLS);
77  TUASSERTFE(0.0, obj.tot);
78  TUASSERTE(unsigned, 0, obj.wnot);
79  TUASSERTE(unsigned, 0, obj.wnLSF);
80  TUASSERTE(unsigned, 0, obj.dn);
81  TUASSERTFE(0.0, obj.deltatLSF);
83  obj.signal.messageType);
84  TURETURN();
85 }
86 
87 
90 {
91  TUDEF("GPSLNavTimeOffset", "validate");
93  TUASSERTE(bool, true, offs.validate());
94  offs.tot = 602112.0;
95  TUASSERTE(bool, true, offs.validate());
96  offs.dn = 7;
97  TUASSERTE(bool, true, offs.validate());
98  offs.dn = 8;
99  TUASSERTE(bool, false, offs.validate());
100  offs.dn = 7;
101  offs.tot = -0.001;
102  TUASSERTE(bool, false, offs.validate());
103  offs.tot = 602112.1;
104  TUASSERTE(bool, false, offs.validate());
105  TURETURN();
106 }
107 
108 
109 unsigned GPSLNavTimeOffset_T ::
111 {
112  TUDEF("GPSLNavTimeOffset", "getUserTime");
114  obj.timeStamp = gnsstk::GPSWeekSecond(2100,135.0);
115  gnsstk::CommonTime exp(gnsstk::GPSWeekSecond(2100,135.0));
116  // 1x 6s subframe
117  exp = exp + 6.0;
119  TURETURN();
120 }
121 
122 
123 unsigned GPSLNavTimeOffset_T ::
125 {
126  TUDEF("GPSLNavTimeOffset", "getOffset");
128  gnsstk::GPSWeekSecond ws1(2092, 405504.0);
129  gnsstk::GPSWeekSecond ws2(2093, 405504.0);
130  obj.deltatLS = 18.0;
131  obj.a0 = -2.79396772E-09;
132  obj.a1 = -7.10542736E-15;
133  obj.tot = 405504.0;
134  obj.wnot = 2092;
135  obj.refTime = gnsstk::GPSWeekSecond(obj.wnot, obj.tot);
136  double offset;
139  offset));
140  TUASSERTFE(17.99999999720603227615, offset);
142  offset));
143  TUASSERTFE(17.99999999290866981028, offset);
144  TURETURN();
145 }
146 
147 
148 unsigned GPSLNavTimeOffset_T ::
150 {
151  TUDEF("GPSLNavTimeOffset", "getConversions");
152  gnsstk::TimeCvtSet convs;
158  TUCATCH(convs = offs.getConversions());
159  TUASSERTE(size_t, 2, convs.size());
160  TUASSERTE(size_t, 1, convs.count(key1));
161  TUASSERTE(size_t, 1, convs.count(key2));
162  TURETURN();
163 }
164 
165 
166 int main()
167 {
168  GPSLNavTimeOffset_T testClass;
169  unsigned errorTotal = 0;
170 
171  errorTotal += testClass.constructorTest();
172  errorTotal += testClass.validateTest();
173  errorTotal += testClass.getUserTimeTest();
174  errorTotal += testClass.getOffsetTest();
175  errorTotal += testClass.getConversionsTest();
176 
177  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
178  << std::endl;
179 
180  return errorTotal;
181 }
gnsstk::StdNavTimeOffset::deltatLSF
double deltatLSF
Current or future leap second count (UTC only).
Definition: StdNavTimeOffset.hpp:135
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
GPSLNavTimeOffset_T::getOffsetTest
unsigned getOffsetTest()
Definition: GPSLNavTimeOffset_T.cpp:124
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
GPSLNavTimeOffset_T::validateTest
unsigned validateTest()
Definition: GPSLNavTimeOffset_T.cpp:89
GPSLNavTimeOffset_T::getConversionsTest
unsigned getConversionsTest()
Definition: GPSLNavTimeOffset_T.cpp:149
gnsstk::StdNavTimeOffset::src
TimeSystem src
Source time system.
Definition: StdNavTimeOffset.hpp:120
GPSLNavTimeOffset_T
Definition: GPSLNavTimeOffset_T.cpp:53
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::TimeCvtKey
std::pair< TimeSystem, TimeSystem > TimeCvtKey
Definition: TimeOffsetData.hpp:53
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::StdNavTimeOffset::tgt
TimeSystem tgt
Target time system.
Definition: StdNavTimeOffset.hpp:121
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::StdNavTimeOffset::deltatLS
double deltatLS
Current or past leap second count (UTC only).
Definition: StdNavTimeOffset.hpp:125
gnsstk::StdNavTimeOffset::wnot
unsigned wnot
Time data reference week number (storage only).
Definition: StdNavTimeOffset.hpp:129
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk::StdNavTimeOffset::wnLSF
unsigned wnLSF
Leap second reference week number (UTC only).
Definition: StdNavTimeOffset.hpp:133
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::StdNavTimeOffset::a1
double a1
Drift coefficient of source time scale.
Definition: StdNavTimeOffset.hpp:123
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::TimeCvtSet
std::set< TimeCvtKey > TimeCvtSet
Define a unique set of time system conversions.
Definition: TimeOffsetData.hpp:55
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
gnsstk::StdNavTimeOffset::dn
unsigned dn
Leap second reference day number (UTC only).
Definition: StdNavTimeOffset.hpp:134
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
TestUtil.hpp
gnsstk::StdNavTimeOffset::a2
double a2
Drift rate coefficient of source time scale.
Definition: StdNavTimeOffset.hpp:124
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::StdNavTimeOffset::getConversions
TimeCvtSet getConversions() const override
Definition: StdNavTimeOffset.cpp:153
gnsstk::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
gnsstk::StdNavTimeOffset::getOffset
bool getOffset(TimeSystem fromSys, TimeSystem toSys, const CommonTime &when, double &offset) const override
Definition: StdNavTimeOffset.cpp:56
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
GPSLNavTimeOffset_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: GPSLNavTimeOffset_T.cpp:110
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
gnsstk::NavMessageType::TimeOffset
@ TimeOffset
Message containing information about time system offsets.
gnsstk::GPSLNavTimeOffset
Definition: GPSLNavTimeOffset.hpp:53
main
int main()
Definition: GPSLNavTimeOffset_T.cpp:166
GPSWeekSecond.hpp
gnsstk::TimeSystem::GPS
@ GPS
GPS system time.
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
GPSLNavTimeOffset.hpp
gnsstk::StdNavTimeOffset::a0
double a0
Bias coefficient of source time scale.
Definition: StdNavTimeOffset.hpp:122
gnsstk::GPSLNavTimeOffset::validate
bool validate() const override
Definition: GPSLNavTimeOffset.cpp:60
gnsstk::StdNavTimeOffset::refTime
CommonTime refTime
Reference time for computation.
Definition: StdNavTimeOffset.hpp:126
GPSLNavTimeOffset_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: GPSLNavTimeOffset_T.cpp:66
gnsstk::StdNavTimeOffset::tot
double tot
Time data reference time of week (storage only).
Definition: StdNavTimeOffset.hpp:128


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