GLOFNavUT1TimeOffset_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 "GLOFNavUT1TimeOffset.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 }
52 
53 
55 {
56 public:
57  unsigned constructorTest();
58  unsigned validateTest();
59  unsigned getUserTimeTest();
60  unsigned getOffsetTest();
61  unsigned getConversionsTest();
62 };
63 
64 
67 {
68  TUDEF("GLOFNavUT1TimeOffset", "GLOFNavUT1TimeOffset");
70  TUASSERTE(int, 1, isnan(uut.tauc));
71  TUASSERTE(int, 1, isnan(uut.B1));
72  TUASSERTE(int, 1, isnan(uut.B2));
73  TUASSERTE(unsigned, -1, uut.KP);
74  TUASSERTE(unsigned, -1, uut.NT);
75  TUASSERTE(unsigned, -1, uut.NA);
77  uut.signal.messageType);
78  TURETURN();
79 }
80 
81 
84 {
85  TUDEF("GLOFNavUT1TimeOffset", "validate");
88  TUASSERTE(bool, true, uut.validate());
89  TURETURN();
90 }
91 
92 
95 {
96  TUDEF("GLOFNavUT1TimeOffset", "getUserTime");
98  uut.timeStamp = gnsstk::CivilTime(2006, 10, 01, 0, 15, 0,
100  // 1x 2s string
101  gnsstk::CommonTime exp(uut.timeStamp + 2.0);
103  TURETURN();
104 }
105 
106 
109 {
110  TUDEF("GLOFNavUT1TimeOffset", "getOffset");
119  7),
122  uut.timeStamp = gnsstk::CivilTime(2021,10,31,20,32,26,
124  uut.tauc = 4.656613E-10;
125  uut.B1 = -1.035156E-01;
126  uut.B2 = -3.051758E-04;
127  uut.KP = 0;
128  uut.NT = 670;
129  uut.NA = 669;
130  gnsstk::CommonTime when1(uut.timeStamp),
131  when2(gnsstk::CivilTime(2021,11,6,0,0,8,gnsstk::TimeSystem::GLO));
132  double offset;
135  when1, offset));
136  TUASSERTFE(-10800.103820775333588, offset);
138  when2, offset));
139  TUASSERTFE(-10800.103820775333588, offset);
140  TURETURN();
141 }
142 
143 
146 {
147  TUDEF("GLOFNavUT1TimeOffset", "getConversions");
148  gnsstk::TimeCvtSet convs;
152  TUCATCH(convs = uut.getConversions());
153  TUASSERTE(size_t, 2, convs.size());
154  TUASSERTE(size_t, 1, convs.count(key1));
155  TUASSERTE(size_t, 1, convs.count(key2));
156  TURETURN();
157 }
158 
159 
160 int main()
161 {
162  GLOFNavUT1TimeOffset_T testClass;
163  unsigned errorTotal = 0;
164 
165  errorTotal += testClass.constructorTest();
166  errorTotal += testClass.validateTest();
167  errorTotal += testClass.getUserTimeTest();
168  errorTotal += testClass.getOffsetTest();
169  errorTotal += testClass.getConversionsTest();
170 
171  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
172  << std::endl;
173 
174  return errorTotal;
175 }
GLOFNavUT1TimeOffset_T::getOffsetTest
unsigned getOffsetTest()
Definition: GLOFNavUT1TimeOffset_T.cpp:108
gnsstk::NavMessageID
Class used to identify/categorize navigation message data.
Definition: NavMessageID.hpp:52
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
main
int main()
Definition: GLOFNavUT1TimeOffset_T.cpp:160
gnsstk::CarrierBand::G1
@ G1
GLONASS G1.
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
GLOFNavUT1TimeOffset_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: GLOFNavUT1TimeOffset_T.cpp:94
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::TimeCvtKey
std::pair< TimeSystem, TimeSystem > TimeCvtKey
Definition: TimeOffsetData.hpp:53
gnsstk::GLOFNavUT1TimeOffset::B1
double B1
Time bias in seconds.
Definition: GLOFNavUT1TimeOffset.hpp:104
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::GLOFNavUT1TimeOffset
Definition: GLOFNavUT1TimeOffset.hpp:59
gnsstk::NavSatelliteID
Definition: NavSatelliteID.hpp:57
gnsstk::GLOFNavUT1TimeOffset::KP
unsigned KP
Leap second indicator.
Definition: GLOFNavUT1TimeOffset.hpp:106
gnsstk::GLOFNavUT1TimeOffset::B2
double B2
Time drift in s/s.
Definition: GLOFNavUT1TimeOffset.hpp:105
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::NavType::GloCivilF
@ GloCivilF
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::TimeCvtSet
std::set< TimeCvtKey > TimeCvtSet
Define a unique set of time system conversions.
Definition: TimeOffsetData.hpp:55
gnsstk::TrackingCode::Standard
@ Standard
Legacy Glonass civil signal.
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
gnsstk::ObservationType::NavMsg
@ NavMsg
Navigation Message data.
gnsstk::GLOFNavUT1TimeOffset::validate
bool validate() const override
Definition: GLOFNavUT1TimeOffset.cpp:181
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
TestUtil.hpp
gnsstk::GLOFNavUT1TimeOffset::tauc
double tauc
Non-integer correction between UTC(SU) and GLONASS.
Definition: GLOFNavUT1TimeOffset.hpp:103
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
GLOFNavUT1TimeOffset_T::getConversionsTest
unsigned getConversionsTest()
Definition: GLOFNavUT1TimeOffset_T.cpp:145
gnsstk::ObsID
Definition: ObsID.hpp:82
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
GLOFNavUT1TimeOffset_T::constructorTest
unsigned constructorTest()
Definition: GLOFNavUT1TimeOffset_T.cpp:66
CivilTime.hpp
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
GLOFNavUT1TimeOffset_T::validateTest
unsigned validateTest()
Definition: GLOFNavUT1TimeOffset_T.cpp:83
gnsstk::TimeSystem::GLO
@ GLO
GLONASS system time (aka UTC(SU))
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
gnsstk::CivilTime
Definition: CivilTime.hpp:55
gnsstk::NavMessageType::TimeOffset
@ TimeOffset
Message containing information about time system offsets.
gnsstk::GLOFNavUT1TimeOffset::NT
unsigned NT
Ephemeris days since leap year.
Definition: GLOFNavUT1TimeOffset.hpp:107
gnsstk::GLOFNavUT1TimeOffset::getConversions
TimeCvtSet getConversions() const override
Definition: GLOFNavUT1TimeOffset.cpp:172
GLOFNavUT1TimeOffset_T
Definition: GLOFNavUT1TimeOffset_T.cpp:54
gnsstk::GLOFNavUT1TimeOffset::NA
unsigned NA
Almanac days since leap year.
Definition: GLOFNavUT1TimeOffset.hpp:108
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::SatelliteSystem::Glonass
@ Glonass
GLOFNavUT1TimeOffset.hpp
gnsstk::NavID
Definition: NavID.hpp:61
gnsstk::GLOFNavUT1TimeOffset::getOffset
bool getOffset(TimeSystem fromSys, TimeSystem toSys, const CommonTime &when, double &offset) const override
Definition: GLOFNavUT1TimeOffset.cpp:149


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