GroupPathCorr.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 
40 #include "GroupPathCorr.hpp"
41 #include "BCISCorrector.hpp"
42 #include "BCIonoCorrector.hpp"
43 #include "TropCorrector.hpp"
44 
45 namespace gnsstk
46 {
47  bool GroupPathCorr ::
48  init(NavLibrary& navLib)
49  {
50  GroupPathCorrectorPtr ec1, ec2;
51  ec1 = std::make_shared<BCISCorrector>(navLib);
52  ec2 = std::make_shared<BCIonoCorrector>(navLib);
53  BCISCorrector *isc = dynamic_cast<BCISCorrector*>(ec1.get());
54  BCIonoCorrector *iono = dynamic_cast<BCIonoCorrector*>(ec2.get());
55  calcs.push_back(ec1);
56  calcs.push_back(ec2);
57  // No error conditions. Yet. Still returning true/false so
58  // that we CAN indicate error conditions in the future
59  // without an API change.
60  return true;
61  }
62 
63 
64  bool GroupPathCorr ::
66  const std::string& rinMetFile)
67  {
68  if (!init(navLib))
69  {
70  return false;
71  }
73  ec3 = std::make_shared<gnsstk::GlobalTropCorrector>();
74  if (!rinMetFile.empty())
75  {
77  trop = dynamic_cast<gnsstk::GlobalTropCorrector*>(ec3.get());
78  if (!trop->loadFile(rinMetFile))
79  {
80  return false;
81  }
82  }
83  calcs.push_back(ec3);
84  return true;
85  }
86 
87 
88  bool GroupPathCorr ::
90  const std::string& rinMetFile)
91  {
92  if (!init(navLib))
93  {
94  return false;
95  }
97  ec3 = std::make_shared<gnsstk::NBTropCorrector>();
98  if (!rinMetFile.empty())
99  {
101  trop = dynamic_cast<gnsstk::NBTropCorrector*>(ec3.get());
102  if (!trop->loadFile(rinMetFile))
103  {
104  return false;
105  }
106  }
107  calcs.push_back(ec3);
108  return true;
109  }
110 
111 
112  bool GroupPathCorr ::
113  getCorr(const Position& rxPos, const Position& svPos,
114  const SatID& sat, const ObsID& obs, const CommonTime& when,
115  NavType nav, CorrectionResults& corrOut, CorrDupHandling dups)
116  {
117  // We always iterate through calcs in the same direction
118  // regardless of the value of dups. It is a known
119  // compromise, so we don't have to duplicate code to use
120  // forward or reverse iterators. You're never going to have
121  // hundreds of group path correctors, as there simply aren't
122  // that many models in existence, so it's a reasonable choice
123  // for a handful of items to iterate over.
124  bool rv = true;
125  corrOut.clear();
126  CorrectorTypeSet seen;
127  double tmp;
128  for (const auto& calc : calcs)
129  {
130  if ((dups == CorrDupHandling::ComputeFirst) &&
131  (seen.count(calc->corrType) > 0))
132  {
133  continue;
134  }
135  if (!calc->getCorr(rxPos, svPos, sat, obs, when, nav, tmp))
136  {
137  rv = false;
138  }
139  else
140  {
141  CorrectionResult res(tmp, calc);
142  corrOut.addResult(res);
143  seen.insert(calc->corrType);
144  }
145  }
146  return rv;
147  }
148 
149 
150  bool GroupPathCorr ::
151  getCorr(const Position& rxPos, const Xvt& svPos,
152  const SatID& sat, const ObsID& obs, const CommonTime& when,
153  NavType nav, CorrectionResults& corrOut, CorrDupHandling dups)
154  {
155  Position sp(svPos.x);
156  return getCorr(rxPos, sp, sat, obs, when, nav, corrOut, dups);
157  }
158 
159 
160  bool GroupPathCorr ::
161  getCorr(const Position& rxPos, const Position& svPos,
162  const SatID& sat, const ObsID& obs, const CommonTime& when,
163  NavType nav, double& corrOut, CorrDupHandling dups)
164  {
165  CorrectionResults res;
166  bool rv = getCorr(rxPos, svPos, sat, obs, when, nav, res, dups);
167  corrOut = res.getCorrSum(dups);
168  return rv;
169  }
170 
171 
172  bool GroupPathCorr ::
173  getCorr(const Position& rxPos, const Xvt& svPos, const SatID& sat,
174  const ObsID& obs, const CommonTime& when, NavType nav,
175  double& corrOut, CorrDupHandling dups)
176  {
177  CorrectionResults res;
178  bool rv = getCorr(rxPos, svPos, sat, obs, when, nav, res, dups);
179  corrOut = res.getCorrSum(dups);
180  return rv;
181  }
182 } // namespace gnsstk
gnsstk::CorrDupHandling
CorrDupHandling
Definition: CorrDupHandling.hpp:60
gnsstk::GroupPathCorr::initNB
bool initNB(NavLibrary &navLib, const std::string &rinMetFile="")
Definition: GroupPathCorr.cpp:89
gnsstk::CorrectionResults::clear
void clear()
Empty the contents of results.
Definition: CorrectionResults.cpp:105
gnsstk::BCIonoCorrector
Definition: BCIonoCorrector.hpp:56
gnsstk::GroupPathCorr::init
bool init(NavLibrary &navLib)
Definition: GroupPathCorr.cpp:48
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::GroupPathCorr::initGlobal
bool initGlobal(NavLibrary &navLib, const std::string &rinMetFile="")
Definition: GroupPathCorr.cpp:65
gnsstk::CorrectionResults::getCorrSum
double getCorrSum(CorrDupHandling dups) const
Definition: CorrectionResults.cpp:59
gnsstk::CorrectionResult
Definition: CorrectionResult.hpp:55
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::Xvt::x
Triple x
Sat position ECEF Cartesian (X,Y,Z) meters.
Definition: Xvt.hpp:151
gnsstk::NavLibrary
Definition: NavLibrary.hpp:944
gnsstk::ObsID
Definition: ObsID.hpp:82
TropCorrector.hpp
gnsstk::CorrDupHandling::ComputeFirst
@ ComputeFirst
Sum includes first valid correction, no duplication.
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::BCISCorrector
Definition: BCISCorrector.hpp:57
gnsstk::TropCorrector
Definition: TropCorrector.hpp:90
gnsstk::Xvt
Definition: Xvt.hpp:60
BCIonoCorrector.hpp
GroupPathCorr.hpp
gnsstk::GroupPathCorr::getCorr
bool getCorr(const Position &rxPos, const Xvt &svPos, const SatID &sat, const ObsID &obs, const CommonTime &when, NavType nav, CorrectionResults &corrOut, CorrDupHandling dups=CorrDupHandling::ComputeFirst)
Definition: GroupPathCorr.cpp:151
gnsstk::GroupPathCorr::calcs
GroupPathCorrectorList calcs
The list of GroupPathCorrector objects to use in the calculation.
Definition: GroupPathCorr.hpp:172
gnsstk::CorrectionResults
Definition: CorrectionResults.hpp:52
gnsstk::GroupPathCorr::getCorr
bool getCorr(const Position &rxPos, const Position &svPos, const SatID &sat, const ObsID &obs, const CommonTime &when, NavType nav, CorrectionResults &corrOut, CorrDupHandling dups=CorrDupHandling::ComputeFirst)
Definition: GroupPathCorr.cpp:113
gnsstk::CorrectionResults::addResult
void addResult(const CorrectionResult &res)
Definition: CorrectionResults.cpp:45
gnsstk::Position
Definition: Position.hpp:136
gnsstk::CorrectorTypeSet
std::set< CorrectorType > CorrectorTypeSet
Set of message types, used by NavLibrary and NavDataFactory.
Definition: CorrectorType.hpp:67
BCISCorrector.hpp
gnsstk::TropCorrector::loadFile
virtual bool loadFile(const std::string &fn)
Load RINEX MET data into wxData, uses Model.
Definition: TropCorrector.hpp:216
gnsstk::NavType
NavType
Supported navigation types.
Definition: NavType.hpp:58
gnsstk::GroupPathCorrectorPtr
std::shared_ptr< GroupPathCorrector > GroupPathCorrectorPtr
Short-hand for shared_ptr.
Definition: GroupPathCorrector.hpp:91
sp
double sp
Definition: IERS1996NutationData.hpp:46


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