TropCorrector_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 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 #include "TestUtil.hpp"
40 #include "TropCorrector.hpp"
41 #include "NavLibrary.hpp"
43 #include "CivilTime.hpp"
44 
45 namespace gnsstk
46 {
47  std::ostream& operator<<(std::ostream& s, CorrectorType t)
48  {
49  s << StringUtils::asString(t);
50  return s;
51  }
52 }
53 
54 
55 template <class Model>
56 class TestClass : public gnsstk::TropCorrector<Model>
57 {
58 public:
60  {}
61  bool getUseDefault() const
63  double getDefTemp() const
65  double getDefPres() const
67  double getDefHum() const
69 };
70 
71 
73 {
74 public:
76  unsigned constructorTest();
77  // These test both getCorr and loadFile.
78  unsigned getCorrTestPosition();
79  unsigned getCorrTestXvt();
80  std::string dataPath;
81 };
82 
83 
86 {
87  dataPath = gnsstk::getPathData() + gnsstk::getFileSep();
88 }
89 
90 
91 unsigned TropCorrector_T ::
93 {
94  TUDEF("TropCorrector", "TropCorrector");
97  TUASSERTE(bool, true, std::isnan(uut.getDefTemp()));
98  TUASSERTE(bool, true, std::isnan(uut.getDefPres()));
99  TUASSERTE(bool, true, std::isnan(uut.getDefHum()));
100  TUASSERTE(bool, false, uut.getUseDefault());
101  // Just make sure the typedefs are still usable.
110  TURETURN();
111 }
112 
113 
114 unsigned TropCorrector_T ::
116 {
117  TUDEF("TropCorrector", "getCorr(Position)");
119  gnsstk::Position stnPos(-740290.01, -5457071.705, 3207245.599);
120  gnsstk::Position svPos(-16208820.579, -207275.833, 21038422.516);
121  gnsstk::CommonTime when(gnsstk::CivilTime(2015,7,19,4,30,0,
127  double corr = 0.0;
128  TUCSM("loadFile");
129  TUASSERTE(bool, true, uut.loadFile(dataPath+"arlm2000.15m"));
130  TUCSM("getCorr(Position)");
131  TUASSERTE(bool, true, uut.getCorr(stnPos, svPos, sat, oid, when, nav, corr));
132  TUASSERTFE(9.775888009609917, corr);
133 
134  // test NBTropModel special handling
136  TUASSERTE(bool, true,
137  uut2.getCorr(stnPos, svPos, sat, oid, when, nav, corr));
138  // epsilon so windows passes ...
139  TUASSERTFEPS(9.4475001293154239335, corr, 1e-14);
140 
142  TUASSERTE(bool, false,
143  uut3.getCorr(stnPos, svPos, sat, oid, when, nav, corr));
144 
146  TUCSM("setDefaultWx");
147  uut4.setDefaultWx();
148  TUASSERTE(bool, true,
149  uut4.getCorr(stnPos, svPos, sat, oid, when, nav, corr));
150  // Different value with the default weather compared without
151  // implies that it's using those default weather values.
152  // epsilon so windows passes ...
153  TUASSERTFEPS(9.1431767236047711833, corr, 1e-14);
154  TURETURN();
155 }
156 
157 
158 unsigned TropCorrector_T ::
160 {
161  TUDEF("TropCorrector", "getCorr(Xvt)");
163  gnsstk::Position stnPos(-740290.01, -5457071.705, 3207245.599);
164  gnsstk::Xvt svPos;
165  svPos.x = gnsstk::Triple(-16208820.579, -207275.833, 21038422.516);
166  // The rest are just bunk with the intent that if the algorithm
167  // is changed to include the data somehow, the assertion fails.
168  svPos.v = gnsstk::Triple(123,456,789);
169  svPos.clkbias = 234;
170  svPos.clkdrift = 345;
171  svPos.relcorr = 456;
172  gnsstk::CommonTime when(gnsstk::CivilTime(2015,7,19,4,30,0,
178  double corr = 0.0;
179  TUCSM("loadFile");
180  TUASSERTE(bool, true, uut.loadFile(dataPath+"arlm2000.15m"));
181  TUCSM("getCorr(Xvt)");
182  TUASSERTE(bool, true, uut.getCorr(stnPos, svPos, sat, oid, when, nav, corr));
183  TUASSERTFE(9.775888009609917, corr);
184  TURETURN();
185 }
186 
187 
188 int main()
189 {
190  unsigned errorTotal = 0;
191  TropCorrector_T testClass;
192 
193  errorTotal += testClass.constructorTest();
194  errorTotal += testClass.getCorrTestPosition();
195  errorTotal += testClass.getCorrTestXvt();
196 
197  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
198  << std::endl;
199 
200  return errorTotal;
201 }
TUCSM
#define TUCSM(METHOD)
Definition: TestUtil.hpp:59
TropCorrector_T::dataPath
std::string dataPath
Definition: TropCorrector_T.cpp:80
gnsstk::CorrectorType
CorrectorType
Identify different sources of pseudorange bias.
Definition: CorrectorType.hpp:52
gnsstk::CorrectorType::Trop
@ Trop
Troposphere (weather) corrector.
gnsstk::ObservationType::Phase
@ Phase
accumulated phase, in cycles
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
example5.oid
oid
Definition: example5.py:29
gnsstk::SatID
Definition: SatID.hpp:89
TropCorrector_T::getCorrTestPosition
unsigned getCorrTestPosition()
Definition: TropCorrector_T.cpp:115
gnsstk::TimeSystem::Any
@ Any
wildcard; allows comparison with any other type
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::Xvt::v
Triple v
satellite velocity in ECEF Cartesian, meters/second
Definition: Xvt.hpp:152
TestClass::getDefHum
double getDefHum() const
Definition: TropCorrector_T.cpp:67
gnsstk::Triple
Definition: Triple.hpp:68
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::NavType::GPSLNAV
@ GPSLNAV
TestClass::getDefTemp
double getDefTemp() const
Definition: TropCorrector_T.cpp:63
gnsstk::Xvt::relcorr
double relcorr
relativity correction (standard 2R.V/c^2 term), seconds
Definition: Xvt.hpp:155
gnsstk::SatelliteSystem::GPS
@ GPS
gnsstk::TrackingCode::CA
@ CA
Legacy GPS civil code.
gnsstk::Xvt::x
Triple x
Sat position ECEF Cartesian (X,Y,Z) meters.
Definition: Xvt.hpp:151
main
int main()
Definition: TropCorrector_T.cpp:188
TestUtil.hpp
NavLibrary.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
MultiFormatNavDataFactory.hpp
TropCorrector_T::getCorrTestXvt
unsigned getCorrTestXvt()
Definition: TropCorrector_T.cpp:159
gnsstk::ObsID
Definition: ObsID.hpp:82
TropCorrector.hpp
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
TropCorrector_T::TropCorrector_T
TropCorrector_T()
Definition: TropCorrector_T.cpp:85
gnsstk::Xvt::clkdrift
double clkdrift
satellite clock drift in seconds/second
Definition: Xvt.hpp:154
gnsstk::TropCorrector
Definition: TropCorrector.hpp:90
TestClass::getCorr
bool getCorr(const gnsstk::Position &rxPos, const gnsstk::Position &svPos, const gnsstk::SatID &sat, const gnsstk::ObsID &obs, const gnsstk::CommonTime &when, gnsstk::NavType nav, double &corrOut) override
Definition: GroupPathCorrector_T.cpp:61
TestClass::TestClass
TestClass()
Definition: TropCorrector_T.cpp:59
TUASSERTFEPS
#define TUASSERTFEPS(EXP, GOT, EPS)
Definition: TestUtil.hpp:126
gnsstk::CarrierBand::L1
@ L1
GPS L1, Galileo E1, SBAS L1, QZSS L1, BeiDou L1.
gnsstk::Xvt
Definition: Xvt.hpp:60
CivilTime.hpp
TropCorrector_T::constructorTest
unsigned constructorTest()
Definition: TropCorrector_T.cpp:92
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
TestClass::getDefPres
double getDefPres() const
Definition: TropCorrector_T.cpp:65
gnsstk::CivilTime
Definition: CivilTime.hpp:55
TestClass
Make GroupPathCorrector instantiatable for testing.
Definition: GroupPathCorrector_T.cpp:56
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::Position
Definition: Position.hpp:136
gnsstk::Xvt::clkbias
double clkbias
Sat clock correction in seconds.
Definition: Xvt.hpp:153
TropCorrector_T
Definition: TropCorrector_T.cpp:72
TestClass::getUseDefault
bool getUseDefault() const
Definition: TropCorrector_T.cpp:61
gnsstk::NavType
NavType
Supported navigation types.
Definition: NavType.hpp:58
gnsstk::GroupPathCorrector::corrType
CorrectorType corrType
Set by child classes, indicates what type of bias is computed.
Definition: GroupPathCorrector.hpp:87


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