This repository was archived by the owner on May 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 188
Expand file tree
/
Copy pathObsClockModel.hpp
More file actions
230 lines (194 loc) · 8.13 KB
/
ObsClockModel.hpp
File metadata and controls
230 lines (194 loc) · 8.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
//==============================================================================
//
// This file is part of GPSTk, the GPS Toolkit.
//
// The GPSTk is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 3.0 of the License, or
// any later version.
//
// The GPSTk is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with GPSTk; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
//
// Copyright 2004-2019, The University of Texas at Austin
//
//==============================================================================
//==============================================================================
//
// This software developed by Applied Research Laboratories at the University of
// Texas at Austin, under contract to an agency or agencies within the U.S.
// Department of Defense. The U.S. Government retains all rights to use,
// duplicate, distribute, disclose, or release this software.
//
// Pursuant to DoD Directive 523024
//
// DISTRIBUTION STATEMENT A: This software has been approved for public
// release, distribution is unlimited.
//
//==============================================================================
/**
* @file ObsClockModel.hpp
* Yet another abstract class used to define an interface to a model that
* accepts GPS observation datat and determines a clock model from it. It
* mainly adds the ability to specify the characteristcs of the observations
* that are to be accpeted into the model. It also defines a function that
* accepts Observed Range Deviations and computes the mean of these (that
* meet the selection criteria) as an estimate of the receiver clock.
*/
#ifndef OBSCLOCKMODEL_HPP
#define OBSCLOCKMODEL_HPP
#include <map>
#include "Exception.hpp"
#include "gps_constants.hpp"
#include "Stats.hpp"
#include "ClockModel.hpp"
#include "ORDEpoch.hpp"
namespace gpstk
{
/// @ingroup ClockModel
//@{
class ObsClockModel : public ClockModel
{
public:
enum SvMode
{
IGNORE, ///< do not include ORDs from this SV
HEALTHY, ///< include ORDs from this SV if it is healthy
ALWAYS ///< always include ORDs from this SV
};
enum SvStatus
{
USED, ///< ORD used in the clock bias computation
MANUAL, ///< ORD removed from computation by user request
SVHEALTH, ///< ORD removed from computation because SV unhealthy
ELEVATION, ///< ORD removed from computation because SV elevation < mask
WONKY, ///< ORD removed due to being flagged wonky
SIGMA ///< ORD removed from computation because it was outlier
};
/// defines a store for each SV's #SvMode
typedef std::map<SatID, SvMode> SvModeMap;
/// defines a store for each SV's #SvStatus
typedef std::map<SatID, SvStatus> SvStatusMap;
ObsClockModel(double sigma = 2, double elmask = 0, SvMode mode = ALWAYS)
: sigmam(sigma), elvmask(elmask), useWonkyData(false)
{
status.clear();
setSvMode(mode);
}
virtual void addEpoch(const ORDEpoch& re) noexcept(false) = 0;
// set accessor methods ----------------------------------------------
/**
* set a SvMode for all SVs.
* @param right #SvModeMap
* @return a reference to this object
*/
ObsClockModel& setSvModeMap(const SvModeMap& right) noexcept;
/**
* set the SvMode for a particular SV.
* @param prn Sv number of the SV
* @param mode #SvMode for the SV
* @return a reference to this object
*/
ObsClockModel& setSvMode(const SatID& svid, const SvMode& mode) noexcept
{ modes[svid] = mode; return *this; }
/**
* set the SvMode for all SVs
* @param mode #SvMode for the SVs
* @return a reference to this object
*/
ObsClockModel& setSvMode(const SvMode& mode) noexcept
{
for(int prn = 1; prn <= gpstk::MAX_PRN; prn++)
{
SatID svid(prn, SatID::systemGPS);
modes[svid] = mode;
}
return *this;
}
/**
* set the sigma multiple for ORD stripping.
* @param right sigma multiple value
* @return a reference to this object
*/
ObsClockModel& setSigmaMultiplier(double right) noexcept
{ sigmam = right; return *this; }
/**
* set the elevation mask angle for ORD stripping.
* @param right elevation mask angle value
* @return a reference to this object
*/
ObsClockModel& setElevationMask(double right) noexcept
{ elvmask = right; return *this; }
/** Set useWonkyData true and ords that are flagged as wonky
will be included in any clock estimation calculations.
**/
ObsClockModel& setUseWonkyData(bool right) noexcept
{ useWonkyData = right; return *this; }
// get accessor methods ----------------------------------------------
/**
* get the map indicating how each ORD was used in the bias
* computation.
* @return a const reference to the #SvStatusMap
*/
const SvStatusMap& getSvStatusMap() const noexcept
{ return status; };
/**
* get the status of a particular ORD in the bias computation.
* @param prn the PRN number indicating the ORD of interest
* @return #SvStatus
* @exception ObjectNotFound an ORD for that SV is not in the map
*/
SvStatus getSvStatus(const SatID& svid) const noexcept(false);
/**
* get the map indicating how to use each ORD in the bias computation.
* @return a const reference to the #SvModeMap
*/
const SvModeMap& getSvModeMap() const noexcept { return modes; }
/**
* get how a particular ORD is to be used in the bias computation.
* @param prn the Sv number indicating the mode of interest
* @return #SvMode
* @exception ObjectNotFound a mode for that SV is not in the map
*/
SvMode getSvMode(const SatID& svid) const noexcept(false);
/**
* returns the sigma multiple value used for ORD stripping.
* @return sigma multiple
*/
double getSigmaMultiplier() const noexcept { return sigmam; }
/**
* returns the elevation mask angle used for ORD stripping.
* @return elevation mask angle
*/
double getElevationMask() const noexcept { return elvmask; }
/**
* return the current value of the userWonkyData flag.
*/
bool getUseWonkyData() const noexcept
{ return useWonkyData; }
/** Computes an average of all ORD in the epoch that pass the
* elevation mask, and SvModeMap tests, removes those ORDS
* that exceede the sigmam value and returns the resulting
* statistics. This is effectivly a simple single epoch clock
* model. */
Stats<double> simpleOrdClock(const ORDEpoch& oe)
noexcept(false);
virtual void dump(std::ostream& s, short detail=1) const noexcept;
friend std::ostream& operator<<(std::ostream& s, const ObsClockModel& r)
{ r.dump(s, 0); return s; };
protected:
double sigmam; ///< sigma multiple value for ORD stripping
double elvmask; ///< elevation mask angle for ORD stripping
SvStatusMap status; ///< map of ORD usage in bias computation
SvModeMap modes; ///< map of modes to use ORDs in bias computation
bool useWonkyData; ///< set to use ords that are flagged wonky
};
//@}
}
#endif