GPSCNavIono_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 "GPSCNavIono.hpp"
40 #include "TestUtil.hpp"
41 #include "GPSWeekSecond.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 
53 {
54 public:
56  unsigned constructorTest();
57  unsigned validateTest();
58  unsigned getUserTimeTest();
59  unsigned getIonoCorrTest();
60 };
61 
62 
63 unsigned GPSCNavIono_T ::
65 {
66  TUDEF("GPSCNavIono", "GPSCNavIono");
69  uut.signal.messageType);
70  TUASSERTE(uint32_t, 0, uut.pre);
71  TUASSERTE(bool, false, uut.alert);
72  TURETURN();
73 }
74 
75 
76 unsigned GPSCNavIono_T ::
78 {
79  TUDEF("GPSCNavIono", "validate");
81  TUASSERTE(bool, true, uut.validate());
82  uut.pre = 0x8b;
83  TUASSERTE(bool, true, uut.validate());
84  uut.pre = 0x8c;
85  TUASSERTE(bool, false, uut.validate());
86  TURETURN();
87 }
88 
89 
90 unsigned GPSCNavIono_T ::
92 {
93  TUDEF("GPSCNavIono", "getUserTime");
95  // L2 has a 12s cadence, L5 has a 6s cadence
96  gnsstk::CommonTime expL2(gnsstk::GPSWeekSecond(2100,147.0));
97  gnsstk::CommonTime expL5(gnsstk::GPSWeekSecond(2100,141.0));
98  uut.timeStamp = gnsstk::GPSWeekSecond(2100,135.0);
111  TURETURN();
112 }
113 
114 
115 unsigned GPSCNavIono_T ::
117 {
118  TUDEF("GPSCNavIono", "getIonoCorr");
120  gnsstk::CommonTime when = gnsstk::GPSWeekSecond(2100,135.0);
121  gnsstk::Position rx, sv;
122  rx.setECEF(-1575232.0141,-4707872.2332, 3993198.4383);
123  sv.setECEF(18217581.007, -14220522.580, 12707796.859);
124  uut.alpha[0] = 1.11758709E-08;
125  uut.alpha[1] = -2.37159346E-09;
126  uut.alpha[2] = -6.03921316E-09;
127  uut.alpha[3] = 3.84468251E-09;
128  uut.beta[0] = 1.16736000E+05;
129  uut.beta[1] = -7.30126485E+04;
130  uut.beta[2] = -1.32803702E+04;
131  uut.beta[3] = 3.38181850E+04;
132  TUASSERTFE(13.174577965354167475,
133  uut.getIonoCorr(when, rx, sv, gnsstk::CarrierBand::L2));
134  TUASSERTFE(7.9994064218713107906,
135  uut.getIonoCorr(when, rx, sv, gnsstk::CarrierBand::L1));
136  TURETURN();
137 }
138 
139 
140 int main()
141 {
142  GPSCNavIono_T testClass;
143  unsigned errorTotal = 0;
144 
145  errorTotal += testClass.constructorTest();
146  errorTotal += testClass.validateTest();
147  errorTotal += testClass.getUserTimeTest();
148  errorTotal += testClass.getIonoCorrTest();
149 
150  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
151  << std::endl;
152 
153  return errorTotal;
154 }
gnsstk::NavMessageID
Class used to identify/categorize navigation message data.
Definition: NavMessageID.hpp:52
gnsstk::GPSCNavIono::validate
bool validate() const override
Definition: GPSCNavIono.cpp:57
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::NavSatelliteID
Definition: NavSatelliteID.hpp:57
gnsstk::TrackingCode::L5I
@ L5I
Modernized GPS L5 civil in-phase.
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::KlobucharIonoNavData::getIonoCorr
double getIonoCorr(const CommonTime &when, const Position &rxgeo, const Position &svgeo, CarrierBand band) const override
Definition: KlobucharIonoNavData.cpp:114
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::CarrierBand::L2
@ L2
GPS L2, QZSS L2.
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
gnsstk::SatelliteSystem::GPS
@ GPS
GPSCNavIono_T::validateTest
unsigned validateTest()
Definition: GPSCNavIono_T.cpp:77
gnsstk::Position::setECEF
Position & setECEF(const double X, const double Y, const double Z) noexcept
Definition: Position.cpp:601
GPSCNavIono.hpp
TestUtil.hpp
gnsstk::GPSCNavIono::getUserTime
CommonTime getUserTime() const override
Definition: GPSCNavIono.cpp:64
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
GPSCNavIono_T
Definition: GPSCNavIono_T.cpp:52
gnsstk::NavType::GPSCNAVL2
@ GPSCNAVL2
gnsstk::NavMessageType::Iono
@ Iono
Ionospheric correction data.
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::CarrierBand::L1
@ L1
GPS L1, Galileo E1, SBAS L1, QZSS L1, BeiDou L1.
gnsstk::KlobucharIonoNavData::beta
double beta[4]
beta terms of Klobuchar model, using semi-circles.
Definition: KlobucharIonoNavData.hpp:85
GPSCNavIono_T::getUserTimeTest
unsigned getUserTimeTest()
Definition: GPSCNavIono_T.cpp:91
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::GPSCNavIono::alert
bool alert
Alert flag.
Definition: GPSCNavIono.hpp:76
GPSWeekSecond.hpp
gnsstk::TrackingCode::L2CM
@ L2CM
Modernized GPS L2 civil M code.
gnsstk::GPSCNavIono
Class containing data elements unique to GPS CNav ionospheric data.
Definition: GPSCNavIono.hpp:50
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
gnsstk::KlobucharIonoNavData::alpha
double alpha[4]
alpha terms of Klobuchar model, using semi-circles.
Definition: KlobucharIonoNavData.hpp:84
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::Position
Definition: Position.hpp:136
main
int main()
Definition: GPSCNavIono_T.cpp:140
gnsstk::GPSCNavIono::pre
uint32_t pre
The preamble from the start of the subframe.
Definition: GPSCNavIono.hpp:75
gnsstk::NavType::GPSCNAVL5
@ GPSCNAVL5
GPSCNavIono_T::constructorTest
unsigned constructorTest()
Make sure constructor initializes data members correctly.
Definition: GPSCNavIono_T.cpp:64
gnsstk::CarrierBand::L5
@ L5
GPS L5, Galileo E5a, SBAS L5, QZSS L5, BeiDou B2a, NavIC L5.
GPSCNavIono_T::getIonoCorrTest
unsigned getIonoCorrTest()
Definition: GPSCNavIono_T.cpp:116


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