KlobucharIonoNavData_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 "KlobucharIonoNavData.hpp"
40 #include "TestUtil.hpp"
41 #include "GPSWeekSecond.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 
55 {
56 public:
57  TestClass() = default;
58  gnsstk::NavDataPtr clone() const override
59  { return std::make_shared<TestClass>(*this); }
60 };
61 
63 {
64 public:
66  unsigned constructorTest();
67  unsigned getIonoCorrTest();
68  unsigned rolloverTest();
69 };
70 
71 
74 {
75  TUDEF("KlobucharIonoNavData", "KlobucharIonoNavData");
76  TestClass uut;
78  uut.signal.messageType);
79  TUASSERTFE(0.0, uut.alpha[0]);
80  TUASSERTFE(0.0, uut.alpha[1]);
81  TUASSERTFE(0.0, uut.alpha[2]);
82  TUASSERTFE(0.0, uut.alpha[3]);
83  TUASSERTFE(0.0, uut.beta[0]);
84  TUASSERTFE(0.0, uut.beta[1]);
85  TUASSERTFE(0.0, uut.beta[2]);
86  TUASSERTFE(0.0, uut.beta[3]);
87  TURETURN();
88 }
89 
90 
93 {
94  TUDEF("KlobucharIonoNavData", "getIonoCorr");
95  TestClass uut;
96  gnsstk::CommonTime when = gnsstk::GPSWeekSecond(2100,135.0);
97  gnsstk::Position rx, sv;
98  rx.setECEF(-1575232.0141,-4707872.2332, 3993198.4383);
99  sv.setECEF(18217581.007, -14220522.580, 12707796.859);
100  uut.alpha[0] = 1.11758709E-08;
101  uut.alpha[1] = -2.37159346E-09;
102  uut.alpha[2] = -6.03921316E-09;
103  uut.alpha[3] = 3.84468251E-09;
104  uut.beta[0] = 1.16736000E+05;
105  uut.beta[1] = -7.30126485E+04;
106  uut.beta[2] = -1.32803702E+04;
107  uut.beta[3] = 3.38181850E+04;
108  TUASSERTFE(13.174577965354167475,
109  uut.getIonoCorr(when, rx, sv, gnsstk::CarrierBand::L2));
110  TUASSERTFE(7.9994064218713107906,
111  uut.getIonoCorr(when, rx, sv, gnsstk::CarrierBand::L1));
112  TURETURN();
113 }
114 
115 
118 {
119  TUDEF("KlobucharIonoNavData", "getIonoCorr(day rollover)");
120  TestClass uut;
121  gnsstk::CommonTime when = gnsstk::CivilTime(2020, 10, 1, 23, 30, 0.0);
122  gnsstk::Position rx, sv;
123  rx.setECEF(-740290.055522, -5457071.691343, 3207245.635068);
124  sv.setECEF(-20606679.6114, -12462848.0260, 11325426.4074);
125  uut.alpha[0] = 1.0244548320770264e-08;
126  uut.alpha[1] = 7.450580596923828e-09;
127  uut.alpha[2] = -5.960464477539063e-08;
128  uut.alpha[3] = -5.960464477539063e-08;
129  uut.beta[0] = 88064.0;
130  uut.beta[1] = 0.0;
131  uut.beta[2] = -196608.0;
132  uut.beta[3] = -65536.0;
133  TUASSERTFE(5.4106367748768136039,
134  uut.getIonoCorr(when, rx, sv, gnsstk::CarrierBand::L1));
135  TURETURN();
136 }
137 
138 
139 int main()
140 {
141  KlobucharIonoNavData_T testClass;
142  unsigned errorTotal = 0;
143 
144  errorTotal += testClass.constructorTest();
145  errorTotal += testClass.getIonoCorrTest();
146  errorTotal += testClass.rolloverTest();
147 
148  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
149  << std::endl;
150 
151  return errorTotal;
152 }
gnsstk::NavDataPtr
std::shared_ptr< NavData > NavDataPtr
Factories instantiate these in response to find() requests.
Definition: NavData.hpp:62
main
int main()
Definition: KlobucharIonoNavData_T.cpp:139
gnsstk::KlobucharIonoNavData
Class containing data elements unique to the Klobuchar iono model.
Definition: KlobucharIonoNavData.hpp:50
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
TestClass::clone
gnsstk::NavDataPtr clone() const override
Definition: KlobucharIonoNavData_T.cpp:58
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::CarrierBand::L2
@ L2
GPS L2, QZSS L2.
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::Position::setECEF
Position & setECEF(const double X, const double Y, const double Z) noexcept
Definition: Position.cpp:601
KlobucharIonoNavData_T::getIonoCorrTest
unsigned getIonoCorrTest()
Definition: KlobucharIonoNavData_T.cpp:92
TestUtil.hpp
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
gnsstk::NavMessageType::Iono
@ Iono
Ionospheric correction data.
KlobucharIonoNavData_T
Definition: KlobucharIonoNavData_T.cpp:62
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
TestClass::TestClass
TestClass()
Definition: GroupPathCorrector_T.cpp:59
gnsstk::CarrierBand::L1
@ L1
GPS L1, Galileo E1, SBAS L1, QZSS L1, BeiDou L1.
CivilTime.hpp
KlobucharIonoNavData.hpp
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::CivilTime
Definition: CivilTime.hpp:55
GPSWeekSecond.hpp
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
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
KlobucharIonoNavData_T::rolloverTest
unsigned rolloverTest()
Definition: KlobucharIonoNavData_T.cpp:117
KlobucharIonoNavData_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: KlobucharIonoNavData_T.cpp:73


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