GPSLNavISC_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 "GPSLNavISC.hpp"
41 #include "TestUtil.hpp"
42 #include "GPSWeekSecond.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:
58  : oid1(gnsstk::ObservationType::Unknown,
60  gnsstk::TrackingCode::CA),
61  oid2(gnsstk::ObservationType::Unknown,
63  gnsstk::TrackingCode::Y),
64  oid3(gnsstk::ObservationType::Unknown,
66  gnsstk::TrackingCode::Y),
69  gnsstk::TrackingCode::Y)
70  {}
72  unsigned constructorTest();
74  unsigned validateTest();
76  unsigned getUserTimeTest();
78  unsigned getISCSFTest();
80  unsigned getISCDFTest();
81 
83 };
84 
85 
86 unsigned GPSLNavISC_T ::
88 {
89  TUDEF("GPSLNavISC", "GPSLNavISC");
92  uut.signal.messageType);
93  TUASSERTE(uint32_t, 0, uut.pre);
94  TUASSERTE(uint32_t, 0, uut.tlm);
95  TUASSERTE(bool, false, uut.isf);
96  TUASSERTE(bool, false, uut.alert);
97  TUASSERTE(bool, false, uut.asFlag);
98  TURETURN();
99 }
100 
101 
102 unsigned GPSLNavISC_T ::
104 {
105  TUDEF("GPSLNavISC", "validate");
106  gnsstk::GPSLNavISC uut;
107  TUASSERTE(bool, true, uut.validate());
108  uut.pre = 0;
109  TUASSERTE(bool, true, uut.validate());
110  uut.pre = 0x8b;
111  TUASSERTE(bool, true, uut.validate());
112  uut.pre = 1;
113  TUASSERTE(bool, false, uut.validate());
114  uut.pre = 0x8c;
115  TUASSERTE(bool, false, uut.validate());
116  TURETURN();
117 }
118 
119 
120 unsigned GPSLNavISC_T ::
122 {
123  TUDEF("GPSLNavISC", "getUserTime");
124  gnsstk::GPSLNavISC uut;
125  uut.timeStamp = gnsstk::GPSWeekSecond(2100,135.0);
126  gnsstk::CommonTime exp(gnsstk::GPSWeekSecond(2100,135.0));
127  exp = exp + 6.0;
129  TURETURN();
130 }
131 
132 
133 unsigned GPSLNavISC_T ::
135 {
136  TUDEF("GPSLNavISC", "getISC(single-frequency)");
137  gnsstk::GPSLNavISC uut;
138  // isc should be nan
139  double corr = 0.123456;
140  double expCorr1 = 0.123456;
141  double expCorr2 = 6.519258E-09;
142  double expCorr3 = 1.0736855745e-08;
143  TUASSERTE(bool, false, uut.getISC(oid1, corr));
144  TUASSERTFE(expCorr1, corr); // corr should not change.
145  // set isc
146  uut.isc = -6.519258E-09;
147  TUASSERTE(bool, true, uut.getISC(oid1, corr));
148  TUASSERTFE(expCorr2, corr);
149  // try again with same band, different code.
150  corr = 0.123456;
151  TUASSERTE(bool, true, uut.getISC(oid2, corr));
152  TUASSERTFE(expCorr2, corr);
153  // and again with L2-Y
154  corr = 0.123456;
155  TUASSERTE(bool, true, uut.getISC(oid3, corr));
156  TUASSERTFE(expCorr3, corr);
157  // again but with an ObservationType other than "Unknown"
158  corr = 0.123456;
159  TUASSERTE(bool, true, uut.getISC(oid4, corr));
160  TUASSERTFE(expCorr3, corr);
161  TURETURN();
162 }
163 
164 
165 unsigned GPSLNavISC_T ::
167 {
168  TUDEF("GPSLNavISC", "getISC(dual-frequency)");
169  gnsstk::GPSLNavISC uut;
170  double corr = 0.123456;
171  // dual frequency getISC should always return 0 for this class
172  TUASSERTE(bool, true, uut.getISC(oid1, oid3, corr));
173  TUASSERTFE(0, corr);
174  corr = 0.123456;
175  TUASSERTE(bool, true, uut.getISC(oid3, oid1, corr));
176  TUASSERTFE(0, corr);
177  TURETURN();
178 }
179 
180 
181 int main()
182 {
183  GPSLNavISC_T testClass;
184  unsigned errorTotal = 0;
185 
186  errorTotal += testClass.constructorTest();
187  errorTotal += testClass.validateTest();
188  errorTotal += testClass.getUserTimeTest();
189  errorTotal += testClass.getISCSFTest();
190  errorTotal += testClass.getISCDFTest();
191 
192  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
193  << std::endl;
194 
195  return errorTotal;
196 }
gnsstk::NavMessageType::ISC
@ ISC
Inter-signal corrections.
gnsstk::NavData::getUserTime
virtual CommonTime getUserTime() const
Definition: NavData.hpp:110
GPSLNavISC_T::oid2
gnsstk::ObsID oid2
Definition: GPSLNavISC_T.cpp:82
L1
gnsstk::Matrix< double > L1
Definition: Matrix_LUDecomp_T.cpp:46
GPSLNavISC_T::getUserTimeTest
unsigned getUserTimeTest()
Check getUserTime()
Definition: GPSLNavISC_T.cpp:121
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::CarrierBand
CarrierBand
Definition: CarrierBand.hpp:54
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::InterSigCorr::getISC
virtual bool getISC(const ObsID &oid, double &corrOut) const
Definition: InterSigCorr.cpp:107
GPSLNavISC_T::getISCDFTest
unsigned getISCDFTest()
Dual frequency ISC test.
Definition: GPSLNavISC_T.cpp:166
GPSLNavISC_T::validateTest
unsigned validateTest()
Check validate()
Definition: GPSLNavISC_T.cpp:103
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
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::InterSigCorr::isc
double isc
Definition: InterSigCorr.hpp:171
GPSLNavISC_T
Definition: GPSLNavISC_T.cpp:54
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
GPSLNavISC_T::oid3
gnsstk::ObsID oid3
Definition: GPSLNavISC_T.cpp:82
GPSLNavISC_T::oid4
gnsstk::ObsID oid4
Definition: GPSLNavISC_T.cpp:82
TestUtil.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
gnsstk::GPSLNavISC::tlm
uint32_t tlm
The TLM message from word 1 of the subframe.
Definition: GPSLNavISC.hpp:69
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
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::GPSLNavISC::pre
uint32_t pre
The TLM preamble from word 1 of the subframe.
Definition: GPSLNavISC.hpp:68
gnsstk::GPSLNavISC::asFlag
bool asFlag
Anti-spoof flag from HOW.
Definition: GPSLNavISC.hpp:72
GPSLNavISC_T::getISCSFTest
unsigned getISCSFTest()
Single frequency ISC test.
Definition: GPSLNavISC_T.cpp:134
GPSWeekSecond.hpp
gnsstk::GPSLNavISC::alert
bool alert
Alert flag from HOW.
Definition: GPSLNavISC.hpp:71
gnsstk::TrackingCode
TrackingCode
Definition: TrackingCode.hpp:64
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
GPSLNavISC.hpp
GPSLNavISC_T::oid1
gnsstk::ObsID oid1
Definition: GPSLNavISC_T.cpp:82
main
int main()
Definition: GPSLNavISC_T.cpp:181
GPSLNavISC_T::GPSLNavISC_T
GPSLNavISC_T()
Definition: GPSLNavISC_T.cpp:57
gnsstk::GPSLNavISC::validate
bool validate() const override
Definition: GPSLNavISC.cpp:71
L2
gnsstk::Matrix< double > L2
Definition: Matrix_LUDecomp_T.cpp:46
GPSLNavISC_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: GPSLNavISC_T.cpp:87
gnsstk::GPSLNavISC::isf
bool isf
Integrity status flag.
Definition: GPSLNavISC.hpp:70
gnsstk::GPSLNavISC
Definition: GPSLNavISC.hpp:53
gnsstk::ObservationType
ObservationType
The type of observation, mostly used by ObsID.
Definition: ObservationType.hpp:55


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