GalINavTimeOffset_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 "GalINavTimeOffset.hpp"
40 #include "TestUtil.hpp"
41 #include "GALWeekSecond.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 getOffsetTest();
60  unsigned getConversionsTest();
61 };
62 
63 
66 {
67  TUDEF("GalINavTimeOffset", "GalINavTimeOffset");
70  TUASSERTFE(0.0, uut.a0);
71  TUASSERTFE(0.0, uut.a1);
72  TUASSERTFE(0.0, uut.a2);
73  TUASSERTFE(0.0, uut.deltatLS);
75  TUASSERTFE(0.0, uut.tot);
76  TUASSERTE(unsigned, 0, uut.wnot);
77  TUASSERTE(unsigned, 0, uut.wnLSF);
78  TUASSERTE(unsigned, 0, uut.dn);
79  TUASSERTFE(0.0, uut.deltatLSF);
81  uut.signal.messageType);
82  TUASSERTFE(0.0, uut.tow);
83  TURETURN();
84 }
85 
86 
89 {
90  TUDEF("GalINavTimeOffset", "validate");
93  TUASSERTE(bool, true, offs.validate());
94  offs.tot = 604784.0;
95  TUASSERTE(bool, true, offs.validate());
96  offs.dn = 7;
97  TUASSERTE(bool, true, offs.validate());
98  offs.dn = 8;
99  TUASSERTE(bool, true, offs.validate());
100  offs.dn = 7;
101  offs.tot = -0.001;
102  TUASSERTE(bool, true, offs.validate());
103  offs.tot = 604784.1;
104  TUASSERTE(bool, true, offs.validate());
105  TURETURN();
106 }
107 
108 
109 unsigned GalINavTimeOffset_T ::
111 {
112  TUDEF("GalINavTimeOffset", "getOffset");
114  gnsstk::GALWeekSecond ws1(2060, 405504.0);
115  gnsstk::GALWeekSecond ws2(2061, 405504.0);
117  uut.a0 = 1.9790604711E-09;
118  uut.a1 = 7.5495165675E-15;
119  uut.a2 = 0;
120  uut.deltatLS = 18.0;
121  uut.tot = 21600.0;
122  uut.wnot = 2060;
123  uut.refTime = gnsstk::GALWeekSecond(uut.wnot,uut.tot);
124  double offset;
127  offset));
128  TUASSERTFE(18.000000004877350079, offset);
130  offset));
131  TUASSERTFE(18.000000009443297699, offset);
132  TURETURN();
133 }
134 
135 
136 unsigned GalINavTimeOffset_T ::
138 {
139  TUDEF("GalINavTimeOffset", "getConversions");
140  gnsstk::TimeCvtSet convs;
142  // This looks a bit weird, but basically getConversions is
143  // expected to return a set containing one key pair for Galileo to
144  // the target time system, which by default is Unknown.
149  TUCATCH(convs = offs.getConversions());
150  TUASSERTE(size_t, 2, convs.size());
151  TUASSERTE(size_t, 1, convs.count(key1));
152  TUASSERTE(size_t, 1, convs.count(key2));
153  TURETURN();
154 }
155 
156 
157 int main()
158 {
159  GalINavTimeOffset_T testClass;
160  unsigned errorTotal = 0;
161 
162  errorTotal += testClass.constructorTest();
163  errorTotal += testClass.validateTest();
164  errorTotal += testClass.getOffsetTest();
165  errorTotal += testClass.getConversionsTest();
166 
167  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
168  << std::endl;
169 
170  return errorTotal;
171 }
GalINavTimeOffset_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: GalINavTimeOffset_T.cpp:65
gnsstk::StdNavTimeOffset::deltatLSF
double deltatLSF
Current or future leap second count (UTC only).
Definition: StdNavTimeOffset.hpp:135
GalINavTimeOffset_T::getOffsetTest
unsigned getOffsetTest()
Definition: GalINavTimeOffset_T.cpp:110
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
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::GALWeekSecond
Definition: GALWeekSecond.hpp:56
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::TimeSystem::Unknown
@ Unknown
unknown time frame; for legacy code compatibility
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::StdNavTimeOffset::a1
double a1
Drift coefficient of source time scale.
Definition: StdNavTimeOffset.hpp:123
gnsstk::TimeCvtSet
std::set< TimeCvtKey > TimeCvtSet
Define a unique set of time system conversions.
Definition: TimeOffsetData.hpp:55
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::TimeSystem::GAL
@ GAL
Galileo system time.
GalINavTimeOffset_T
Definition: GalINavTimeOffset_T.cpp:53
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
GalINavTimeOffset_T::validateTest
unsigned validateTest()
Definition: GalINavTimeOffset_T.cpp:88
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
GalINavTimeOffset_T::getConversionsTest
unsigned getConversionsTest()
Definition: GalINavTimeOffset_T.cpp:137
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
GalINavTimeOffset.hpp
gnsstk::GalINavTimeOffset
Definition: GalINavTimeOffset.hpp:53
gnsstk::NavMessageType::TimeOffset
@ TimeOffset
Message containing information about time system offsets.
main
int main()
Definition: GalINavTimeOffset_T.cpp:157
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::StdNavTimeOffset::a0
double a0
Bias coefficient of source time scale.
Definition: StdNavTimeOffset.hpp:122
gnsstk::GalINavTimeOffset::tow
double tow
TOW field from word type 6.
Definition: GalINavTimeOffset.hpp:68
gnsstk::GalINavTimeOffset::validate
bool validate() const override
Definition: GalINavTimeOffset.cpp:57
gnsstk::StdNavTimeOffset::refTime
CommonTime refTime
Reference time for computation.
Definition: StdNavTimeOffset.hpp:126
GALWeekSecond.hpp
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