KlobucharIonoNavData.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 "TimeString.hpp"
41 #include "YDSTime.hpp"
42 #include "FreqConv.hpp"
43 
44 using namespace std;
45 
46 namespace gnsstk
47 {
48  KlobucharIonoNavData ::
49  KlobucharIonoNavData()
50  : alpha{0,0,0,0},
51  beta{0,0,0,0}
52  {
53  }
54 
55 
57  dump(std::ostream& s, DumpDetail dl) const
58  {
59  if (dl == DumpDetail::OneLine)
60  {
61  NavData::dump(s,dl);
62  return;
63  }
64  // "header"
65  s << "****************************************************************"
66  << "************" << endl
67  << "Ionospheric correction data"
68  << endl
69  << endl
70  << getSignalString() << endl;
71 
72  // the rest is full details, so just return if Full is not asked for.
73  if (dl != DumpDetail::Full)
74  return;
75 
76  const ios::fmtflags oldFlags = s.flags();
77 
78  s.setf(ios::fixed, ios::floatfield);
79  s.setf(ios::right, ios::adjustfield);
80  s.setf(ios::uppercase);
81  s.precision(0);
82  s.fill(' ');
83 
84  s << " TIMES OF INTEREST"
85  << endl << endl
86  << " " << getDumpTimeHdr(dl) << endl
87  << "Transmit: " << getDumpTime(dl, timeStamp) << endl;
88 
89  s.setf(ios::scientific, ios::floatfield);
90  s.precision(8);
91  s.fill(' ');
92 
93  s << endl
94  << " KLOBUCHAR IONO PARAMETERS" << endl
95  << "Parameter Value" << endl
96  << "alpha[0] " << setw(16) << alpha[0] << " sec" << endl
97  << "alpha[1] " << setw(16) << alpha[1] << " sec/semi-circle" << endl
98  << "alpha[2] " << setw(16) << alpha[2] << " sec/semi-circle**2"
99  << endl
100  << "alpha[3] " << setw(16) << alpha[3] << " sec/semi-circle**3"
101  << endl
102  << "beta[0] " << setw(16) << beta[0] << " sec" << endl
103  << "beta[1] " << setw(16) << beta[1] << " sec/semi-circle" << endl
104  << "beta[2] " << setw(16) << beta[2] << " sec/semi-circle**2"
105  << endl
106  << "beta[3] " << setw(16) << beta[3] << " sec/semi-circle**3"
107  << endl;
108 
109  s.flags(oldFlags);
110  }
111 
112 
115  const Position& rxgeo,
116  const Position& svgeo,
117  CarrierBand band) const
118  {
119  // style guide strongly discourages using underscores, but
120  // I'm using them here to denote subscripts, latex style.
121  double el = rxgeo.elevationGeodetic(svgeo) / 180.0;
122  double az = rxgeo.azimuthGeodetic(svgeo) / 180.0;
123  double phi_u = rxgeo.getGeodeticLatitude() / 180.0;
124  double lambda_u = rxgeo.getLongitude() / 180.0;
125  // constant values defined in Figure 20-4, IS-GPS-200
126  double psi = (0.0137 / (el+0.11)) - 0.022;
127  double phi_i = phi_u + psi * ::cos(az * PI);
128  if (phi_i > 0.416)
129  phi_i = 0.416;
130  if (phi_i < -0.416)
131  phi_i = -0.416;
132  double lambda_i = lambda_u + (psi * ::sin(az * PI) / ::cos(phi_i * PI));
133  double t = 43200 * lambda_i + YDSTime(when).sod;
134  if (t >= 86400.0)
135  t -= 86400.0;
136  else if (t < 0.0)
137  t += 86400.0;
138  double phi_m = phi_i + 0.064 * ::cos((lambda_i-1.617) * PI);
139  double iAMP = alpha[0]+phi_m*(alpha[1]+phi_m*(alpha[2]+phi_m*alpha[3]));
140  double iPER = beta[0]+phi_m*( beta[1]+phi_m*( beta[2]+phi_m* beta[3]));
141  if (iAMP < 0.0)
142  iAMP = 0.0;
143  if (iPER < 72000.0)
144  iPER = 72000.0;
145  double x = TWO_PI * (t - 50400.0) / iPER;
146  double iF = 1.0 + 16.0 * (0.53 - el)*(0.53 - el)*(0.53 - el);
147  double t_iono = 0.0;
148  if (fabs(x) < 1.57)
149  {
150  t_iono = iF * (5.0e-9 + iAMP * (1 + x*x * (-0.5 + x*x/24.0)));
151  }
152  else
153  {
154  t_iono = iF * 5.0e-9;
155  }
156  /* Klobuchar models used in GPS and QZSS are referenced to
157  * L1. If other systems use this model, this may need to
158  * change. */
159  if (band != gnsstk::CarrierBand::L1)
160  {
161  double f2 = getFrequency(band);
162  t_iono *= (FREQ_GPS_L1/f2)*(FREQ_GPS_L1/f2);
163  }
164  return t_iono * C_MPS;
165  }
166 }
YDSTime.hpp
gnsstk::NavData::getSignalString
std::string getSignalString() const
Definition: NavData.cpp:86
gnsstk::NavData::dump
virtual void dump(std::ostream &s, DumpDetail dl) const
Definition: NavData.cpp:79
gnsstk::YDSTime
Definition: YDSTime.hpp:58
gnsstk::CarrierBand
CarrierBand
Definition: CarrierBand.hpp:54
gnsstk::KlobucharIonoNavData::dump
void dump(std::ostream &s, DumpDetail dl) const override
Definition: KlobucharIonoNavData.cpp:57
gnsstk::NavData::getDumpTime
std::string getDumpTime(DumpDetail dl, const CommonTime &t) const
Definition: NavData.cpp:145
gnsstk::TWO_PI
const double TWO_PI
GPS value of PI*2.
Definition: GNSSconstants.hpp:68
gnsstk::KlobucharIonoNavData::getIonoCorr
double getIonoCorr(const CommonTime &when, const Position &rxgeo, const Position &svgeo, CarrierBand band) const override
Definition: KlobucharIonoNavData.cpp:114
gnsstk::NavData::getDumpTimeHdr
std::string getDumpTimeHdr(DumpDetail dl) const
Definition: NavData.cpp:127
gnsstk::PI
const double PI
GPS value of PI; also specified by GAL.
Definition: GNSSconstants.hpp:62
FreqConv.hpp
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
std::sin
double sin(gnsstk::Angle x)
Definition: Angle.hpp:144
gnsstk::Position::azimuthGeodetic
double azimuthGeodetic(const Position &Target) const
Definition: Position.cpp:1391
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
gnsstk::C_MPS
const double C_MPS
m/s, speed of light; this value defined by GPS but applies to GAL and GLO.
Definition: GNSSconstants.hpp:74
gnsstk::FREQ_GPS_L1
const double FREQ_GPS_L1
GPS L1 carrier frequency in Hz.
Definition: FreqConsts.hpp:56
gnsstk::Position::getGeodeticLatitude
double getGeodeticLatitude() const noexcept
return geodetic latitude (deg N)
Definition: Position.hpp:454
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::CarrierBand::L1
@ L1
GPS L1, Galileo E1, SBAS L1, QZSS L1, BeiDou L1.
KlobucharIonoNavData.hpp
std::cos
double cos(gnsstk::Angle x)
Definition: Angle.hpp:146
gnsstk::beta
double beta(double x, double y)
Definition: SpecialFuncs.cpp:204
gnsstk::YDSTime::sod
double sod
Definition: YDSTime.hpp:186
gnsstk::KlobucharIonoNavData::beta
double beta[4]
beta terms of Klobuchar model, using semi-circles.
Definition: KlobucharIonoNavData.hpp:85
gnsstk::DumpDetail::Full
@ Full
Include all detailed information.
gnsstk::DumpDetail
DumpDetail
Specify level of detail for dump output.
Definition: DumpDetail.hpp:51
std
Definition: Angle.hpp:142
gnsstk::Position::getLongitude
double getLongitude() const noexcept
return longitude (deg E) (either geocentric or geodetic)
Definition: Position.hpp:464
gnsstk::KlobucharIonoNavData::alpha
double alpha[4]
alpha terms of Klobuchar model, using semi-circles.
Definition: KlobucharIonoNavData.hpp:84
gnsstk::Position
Definition: Position.hpp:136
gnsstk::DumpDetail::OneLine
@ OneLine
Limit output to minimal information on a single line.
gnsstk::getFrequency
double getFrequency(CarrierBand band)
Definition: FreqConv.cpp:43
gnsstk::Position::elevationGeodetic
double elevationGeodetic(const Position &Target) const
Definition: Position.cpp:1331
TimeString.hpp


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