TropCorrector.hpp
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 
40 #ifndef GNSSTK_TROPCORRECTOR_HPP
41 #define GNSSTK_TROPCORRECTOR_HPP
42 
43 #include "GroupPathCorrector.hpp"
44 #include "SimpleTropModel.hpp"
45 #include "SaasTropModel.hpp"
46 #include "NBTropModel.hpp"
47 #include "GGTropModel.hpp"
48 #include "GGHeightTropModel.hpp"
49 #include "NeillTropModel.hpp"
50 #include "GlobalTropModel.hpp"
51 #include "MetReader.hpp"
52 #include "YDSTime.hpp"
53 
54 // forward declaration of test class
55 class GroupPathCorr_T;
56 
57 namespace gnsstk
58 {
60 
61 
89  template <class Model>
91  {
92  public:
94  TropCorrector();
96  bool getCorr(const Position& rxPos, const Position& svPos,
97  const SatID& sat, const ObsID& obs,
98  const CommonTime& when, NavType nav,
99  double& corrOut) override;
101  bool getCorr(const Position& rxPos, const Xvt& svPos,
102  const SatID& sat, const ObsID& obs,
103  const CommonTime& when, NavType nav,
104  double& corrOut) override;
109  virtual void setDefaultWx(double temp=20, double pres=1013,
110  double hum=50);
112  virtual bool loadFile(const std::string& fn);
115  protected:
118  double defTemp;
119  double defPres;
120  double defHum;
121 
126  virtual void setWeather(Model& model, const CommonTime& when);
127 
128  // For testing. Tried adding a const ref accessor, but SWIG
129  // complained about it. This is the easier solution.
130  friend class ::GroupPathCorr_T;
131  }; // class TropCorrector
132 
133 
150 
152 
153  template <class Model>
156  : useDefault(false),
157  defTemp(std::numeric_limits<double>::quiet_NaN()),
158  defPres(std::numeric_limits<double>::quiet_NaN()),
159  defHum(std::numeric_limits<double>::quiet_NaN())
160  {
162  }
163 
164 
165  template <class Model>
167  getCorr(const Position& rxPos, const Position& svPos,
168  const SatID& sat, const ObsID& obs,
169  const CommonTime& when, NavType nav,
170  double& corrOut)
171  {
172  Model model;
173  model.setReceiverHeight(rxPos.height());
174  model.setReceiverLatitude(rxPos.getGeodeticLatitude());
175  model.setReceiverLongitude(rxPos.getLongitude());
176  model.setDayOfYear(YDSTime(when).doy);
177  try
178  {
179  setWeather(model, when);
180  corrOut = model.correction(rxPos, svPos, when);
181  return true;
182  }
183  catch (...)
184  {
185  corrOut = std::numeric_limits<double>::quiet_NaN();
186  return false;
187  }
188  }
189 
190 
191  template <class Model>
193  getCorr(const Position& rxPos, const Xvt& svPos,
194  const SatID& sat, const ObsID& obs,
195  const CommonTime& when, NavType nav,
196  double& corrOut)
197  {
198  Position svp(svPos.x);
199  return getCorr(rxPos, svp, sat, obs, when, nav, corrOut);
200  }
201 
202 
203  template <class Model>
205  setDefaultWx(double temp, double pres, double hum)
206  {
207  useDefault = true;
208  defTemp = temp;
209  defPres = pres;
210  defHum = hum;
211  }
212 
213 
214  template <class Model>
216  loadFile(const std::string& fn)
217  {
218  useDefault = false;
219  wxData.read(fn);
220  return true;
221  }
222 
223 
224  template <class Model>
226  setWeather(Model& model, const CommonTime& when)
227  {
228  if (!useDefault)
229  {
230  model.setWeather(wxData.wx.getWxObservation(when));
231  }
232  else
233  {
234  model.setWeather(defTemp, defPres, defHum);
235  }
236  }
237 
238 
240  template <>
242  setWeather(NBTropModel& model, const CommonTime& when)
243  {
244  if (!useDefault)
245  {
246  if (wxData.wx.obs.empty())
247  {
248  // Haven't used the default weather via
249  // setDefaultWx() and if loadFile was called, it was
250  // unsuccessful. Maybe using the New Brunswick
251  // special case, so try that.
252  model.setWeather();
253  }
254  else
255  {
256  model.setWeather(wxData.wx.getWxObservation(when));
257  }
258  }
259  else
260  {
261  model.setWeather(defTemp, defPres, defHum);
262  }
263  }
264 
265 } // namespace gnsstk
266 
267 #endif // GNSSTK_TROPCORRECTOR_HPP
gnsstk::MetReader
Definition: MetReader.hpp:51
gnsstk::TropCorrector::defHum
double defHum
Default humidity (%).
Definition: TropCorrector.hpp:120
YDSTime.hpp
gnsstk::NBTropModel
Definition: NBTropModel.hpp:86
gnsstk::SimpleTropCorrector
TropCorrector< SimpleTropModel > SimpleTropCorrector
Wrapper for the "simple" trop model.
Definition: TropCorrector.hpp:137
GGTropModel.hpp
gnsstk::CorrectorType::Trop
@ Trop
Troposphere (weather) corrector.
gnsstk::YDSTime
Definition: YDSTime.hpp:58
SaasTropModel.hpp
MetReader.hpp
gnsstk::TropCorrector::setWeather
virtual void setWeather(Model &model, const CommonTime &when)
Definition: TropCorrector.hpp:226
GroupPathCorr_T
Definition: GroupPathCorr_T.cpp:155
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::TropCorrector::defTemp
double defTemp
Default temperature value (degrees C).
Definition: TropCorrector.hpp:118
gnsstk::Position::height
double height() const noexcept
return height above ellipsoid (meters) (Geodetic).
Definition: Position.cpp:455
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
GGHeightTropModel.hpp
example4.temp
temp
Definition: example4.py:35
gnsstk::NeillTropCorrector
TropCorrector< NeillTropModel > NeillTropCorrector
Wrapper for the A.E. Neill trop model.
Definition: TropCorrector.hpp:147
gnsstk::Xvt::x
Triple x
Sat position ECEF Cartesian (X,Y,Z) meters.
Definition: Xvt.hpp:151
gnsstk::TropCorrector::defPres
double defPres
Default pressure value (millibars).
Definition: TropCorrector.hpp:119
gnsstk::ZeroTropCorrector
TropCorrector< ZeroTropModel > ZeroTropCorrector
Somewhat pointless wrapper for zero trop correction model.
Definition: TropCorrector.hpp:135
gnsstk::ObsID
Definition: ObsID.hpp:82
gnsstk::Position::getGeodeticLatitude
double getGeodeticLatitude() const noexcept
return geodetic latitude (deg N)
Definition: Position.hpp:454
gnsstk::SaasTropCorrector
TropCorrector< SaasTropModel > SaasTropCorrector
Wrapper for the Saastamoinen trop model.
Definition: TropCorrector.hpp:139
gnsstk::CommonTime
Definition: CommonTime.hpp:84
NBTropModel.hpp
gnsstk::TropCorrector
Definition: TropCorrector.hpp:90
GroupPathCorrector.hpp
gnsstk::Xvt
Definition: Xvt.hpp:60
gnsstk::TropCorrector::TropCorrector
TropCorrector()
Set the corrType to Trop for GroupPathCorr.
Definition: TropCorrector.hpp:155
SimpleTropModel.hpp
gnsstk::NBTropCorrector
TropCorrector< NBTropModel > NBTropCorrector
Wrapper for the Univeristy of New Brunswick trop model.
Definition: TropCorrector.hpp:141
NeillTropModel.hpp
std
Definition: Angle.hpp:142
gnsstk::GGTropCorrector
TropCorrector< GGTropModel > GGTropCorrector
Wrapper for the Goad and Goodman trop model.
Definition: TropCorrector.hpp:143
gnsstk::GlobalTropCorrector
TropCorrector< GlobalTropModel > GlobalTropCorrector
Wrapper for the global trop model (Boehm et al).
Definition: TropCorrector.hpp:149
gnsstk::Position::getLongitude
double getLongitude() const noexcept
return longitude (deg E) (either geocentric or geodetic)
Definition: Position.hpp:464
gnsstk::TropCorrector::wxData
MetReader wxData
Read and store weather data for look-up (single site)
Definition: TropCorrector.hpp:114
gnsstk::Position
Definition: Position.hpp:136
example5.fn
string fn
Definition: example5.py:10
GlobalTropModel.hpp
gnsstk::TropCorrector::loadFile
virtual bool loadFile(const std::string &fn)
Load RINEX MET data into wxData, uses Model.
Definition: TropCorrector.hpp:216
gnsstk::GGHeightTropCorrector
TropCorrector< GGHeightTropModel > GGHeightTropCorrector
Wrapper for the Goad and Goodman trop model with heights.
Definition: TropCorrector.hpp:145
gnsstk::NavType
NavType
Supported navigation types.
Definition: NavType.hpp:58
gnsstk::TropCorrector::useDefault
bool useDefault
Set to true if setDefaultWx was called more recently than loadFile.
Definition: TropCorrector.hpp:117
gnsstk::GroupPathCorrector::corrType
CorrectorType corrType
Set by child classes, indicates what type of bias is computed.
Definition: GroupPathCorrector.hpp:87
gnsstk::TropCorrector::getCorr
bool getCorr(const Position &rxPos, const Position &svPos, const SatID &sat, const ObsID &obs, const CommonTime &when, NavType nav, double &corrOut) override
Definition: TropCorrector.hpp:167
gnsstk::NBTropModel::setWeather
virtual void setWeather(const WxObservation &wx)
Definition: NBTropModel.cpp:340
gnsstk::GroupPathCorrector
Definition: GroupPathCorrector.hpp:61
gnsstk::TropCorrector::setDefaultWx
virtual void setDefaultWx(double temp=20, double pres=1013, double hum=50)
Definition: TropCorrector.hpp:205


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