ObsClockModel.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 
49 #include <math.h>
50 
51 #include "ObsClockModel.hpp"
52 
53 namespace gnsstk
54 {
55  using namespace std;
56 
57 
59  {
60  SvStatusMap::const_iterator i = status.find(svid);
61  if(i == status.end())
62  {
63  gnsstk::ObjectNotFound e("No status for SV " +
65  " available.");
66  GNSSTK_THROW(e);
67  }
68  else
69  return i->second;
70  }
71 
72 
74  noexcept
75  {
76  for(int prn = 1; prn <= gnsstk::MAX_PRN; prn++)
77  modes[SatID(prn, SatelliteSystem::GPS)] = IGNORE;
78 
79  for(SvModeMap::const_iterator i = right.begin(); i != right.end(); i++)
80  modes[i->first] = i->second;
81 
82  return *this;
83  }
84 
85 
87  {
88  SvModeMap::const_iterator i = modes.find(svid);
89  if(i == modes.end())
90  {
91  gnsstk::ObjectNotFound e("No status for SV " +
93  " available.");
94  GNSSTK_THROW(e);
95  }
96  else
97  return i->second;
98  }
99 
100 
105  {
107 
108  status.clear();
109 
110  ORDEpoch::ORDMap::const_iterator itr;
111  for(itr = oe.ords.begin(); itr != oe.ords.end(); itr++)
112  {
113  const SatID& svid = itr->first;
114  const ObsRngDev& ord=itr->second;
115  switch (modes[svid])
116  {
117  case IGNORE:
118  status[svid] = MANUAL;
119  break;
120  case ALWAYS:
121  status[svid] = USED;
122  break;
123  case HEALTHY:
124  // SV Health bits are defined in ICD-GPS-200C-IRN4 20.3.3.3.1.4
125  // It is a 6-bit value where the MSB (0x20) indicates a summary of
126  // of NAV data health where 0 = OK, 1 = some or all BAD
127  if (ord.getHealth().is_valid() && (ord.getHealth() & 0x20))
128  status[svid] = SVHEALTH;
129  else
130  status[svid] = USED;
131  break;
132  }
133 
134  if (ord.getElevation() < elvmask)
135  status[svid] = ELEVATION;
136 
137  if (ord.wonky && !useWonkyData)
138  status[svid] = WONKY;
139 
140  if (status[svid] == USED)
141  stat.Add(ord.getORD());
142  }
143 
144  if (stat.N() > 2)
145  {
146  for (itr = oe.ords.begin(); itr != oe.ords.end(); itr++)
147  {
148  const SatID& svid = itr->first;
149 
150  // don't override other types of stripping
151  if (status[svid] == USED)
152  {
153  // get absolute distance of residual from mean
154  double res = itr->second.getORD();
155  double dist = res - stat.Average();
156  if(fabs(dist) > (sigmam * stat.StdDev()))
157  status[svid] = SIGMA;
158  }
159  }
160 
161  // now, recompute the statistics on unstripped residuals to get
162  // the clock bias value
163  stat.Reset();
164  for (itr = oe.ords.begin(); itr != oe.ords.end(); itr++)
165  if (status[itr->second.getSvID()] == USED)
166  stat.Add(itr->second.getORD());
167  }
168 
169  return stat;
170  }
171 
172  void ObsClockModel::dump(ostream& s, short detail) const noexcept
173  {
174  s << "min elev:" << elvmask
175  << ", max sigma:" << sigmam
176  << ", prn/status: ";
177 
178  ObsClockModel::SvStatusMap::const_iterator i;
179  for ( i=status.begin(); i!= status.end(); i++)
180  s << i->first << "/" << i->second << " ";
181  }
182 }
example3.svid
svid
Definition: example3.py:19
gnsstk::ObsRngDev::getHealth
vshort getHealth() const noexcept
Definition: ObsRngDev.hpp:313
gnsstk::ObsClockModel::getSvMode
SvMode getSvMode(const SatID &svid) const
Definition: ObsClockModel.cpp:86
gnsstk::ObsClockModel::SvMode
SvMode
Definition: ObsClockModel.hpp:69
gnsstk::ObsClockModel::simpleOrdClock
Stats< double > simpleOrdClock(const ORDEpoch &oe)
Definition: ObsClockModel.cpp:104
gnsstk::ObsClockModel::SvStatus
SvStatus
Definition: ObsClockModel.hpp:76
gnsstk::Stats::StdDev
T StdDev(void) const
return computed standard deviation
Definition: Stats.hpp:347
gnsstk::ObsClockModel
Definition: ObsClockModel.hpp:66
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::Stats::Reset
void Reset(void)
reset, i.e. ignore earlier data and restart sampling
Definition: Stats.hpp:146
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::Stats< double >
gnsstk::ObsRngDev
Definition: ObsRngDev.hpp:73
gnsstk::SatelliteSystem::GPS
@ GPS
gnsstk::ObsRngDev::getElevation
vfloat getElevation() const noexcept
Definition: ObsRngDev.hpp:306
gnsstk::ObsClockModel::setSvModeMap
ObsClockModel & setSvModeMap(const SvModeMap &right) noexcept
Definition: ObsClockModel.cpp:73
gnsstk::ValidType::is_valid
bool is_valid() const
Definition: ValidType.hpp:96
gnsstk::MAX_PRN
const long MAX_PRN
Definition: gps_constants.hpp:55
gnsstk::ObsClockModel::dump
virtual void dump(std::ostream &s, short detail=1) const noexcept
Definition: ObsClockModel.cpp:172
example5.oe
oe
Definition: example5.py:19
gnsstk::ObsRngDev::getORD
double getORD() const noexcept
Definition: ObsRngDev.hpp:327
gnsstk::ObsClockModel::SvModeMap
std::map< SatID, SvMode > SvModeMap
defines a store for each SV's SvMode
Definition: ObsClockModel.hpp:87
gnsstk::ORDEpoch
Definition: ORDEpoch.hpp:59
std
Definition: Angle.hpp:142
ObsClockModel.hpp
gnsstk::Stats::Average
T Average(void) const
return the average
Definition: Stats.hpp:329
gnsstk::Stats::Add
void Add(const T &x)
Definition: Stats.hpp:158
GNSSTK_THROW
#define GNSSTK_THROW(exc)
Definition: Exception.hpp:366
gnsstk::ObsRngDev::wonky
unsigned wonky
A bitmask defined by the application to flag questionable data.
Definition: ObsRngDev.hpp:393
gnsstk::ObsClockModel::getSvStatus
SvStatus getSvStatus(const SatID &svid) const
Definition: ObsClockModel.cpp:58
gnsstk::Stats::N
unsigned int N(void) const
return the sample size
Definition: Stats.hpp:318


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