0.2.0
Loading...
Searching...
No Matches
MeasurementErrors.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
15
16#pragma once
17
18#include <array>
19
22#include "Navigation/Transformations/Units.hpp"
23
25
26namespace NAV
27{
28
31{
32 public:
35
50
56 [[nodiscard]] double psrMeasErrorVar(const SatelliteSystem& satSys, double elevation, double cn0) const;
57
63 [[nodiscard]] double carrierMeasErrorVar(const SatelliteSystem& satSys, double elevation, double cn0) const;
64
71 [[nodiscard]] double psrRateMeasErrorVar(const Frequency& freq, int8_t num, double elevation, double cn0) const;
72
75 [[nodiscard]] double codeBiasErrorVar() const;
76
80 bool ShowGuiWidgets(const char* id, float width);
81
82 private:
84 Model _model = RTKLIB;
85
87 double _carrierStdDev = 0.003;
89 double _codeStdDev = 0.9;
91 double _dopplerStdDev = 1;
92
94 double _plotCN0 = 30;
95
96 // #######################################################################################################
97
99 struct ModelParametersSine
100 {
101 double a = 1.0;
102 };
104 ModelParametersSine _modelParametersSine;
105
107 struct ModelParametersSineOffset
108 {
109 double a = 0.5;
110 double b = 0.5;
111 };
113 ModelParametersSineOffset _modelParametersSineOffset;
114
116 struct ModelParametersSineCN0
117 {
118 double a = 1.0;
119 double b = 1.0;
120 double c = 1.0;
121 };
123 ModelParametersSineCN0 _modelParametersSineCN0;
124
126 struct ModelParametersRtklib
127 {
128 double a = 1.0;
129 double b = 1.0;
130 };
132 ModelParametersRtklib _modelParametersRtklib;
133
135 struct ModelParametersSineType
136 {
137 double a = 0.64;
138 double b = 0.36;
139 };
141 ModelParametersSineType _modelParametersSineType;
142
144 struct ModelParametersSineSqrt
145 {
146 double a = 0.3;
147 double b = 0.5;
148 };
150 ModelParametersSineSqrt _modelParametersSineSqrt;
151
153 struct ModelParametersExponential
154 {
155 double a = 1.0;
156 double b = 3.5;
157 double e0 = 9;
158 };
160 ModelParametersExponential _modelParametersExponential;
161
163 struct ModelParametersCosineType
164 {
165 double a = 1.0;
166 double b = 4.0;
167 int n = 8;
168 };
170 ModelParametersCosineType _modelParametersCosineType;
171
172 // #######################################################################################################
173
175 static constexpr size_t PLOT_SAMPLES = 9001;
177 static constexpr std::array<double, PLOT_SAMPLES> _elevation = genRangeArray<PLOT_SAMPLES>(0.0, deg2rad(0.01), deg2rad(90.001));
179 static constexpr std::array<double, PLOT_SAMPLES> _elevation_deg = genRangeArray<PLOT_SAMPLES>(0.0, 0.01, 90.001);
181 std::vector<std::vector<double>> _stdDevCurvePlot{ Model::COUNT, std::vector<double>(PLOT_SAMPLES) };
182
187 [[nodiscard]] double weightingFunction(Model model, double elevation, double cn0) const;
188
191 [[nodiscard]] static double satSysErrorFactorVariance(const SatelliteSystem& satSys);
192
195 void updateStdDevCurvePlot(Model model);
196
197 friend void to_json(json& j, const GnssMeasurementErrorModel& obj);
198 friend void from_json(const json& j, GnssMeasurementErrorModel& obj);
199
200 friend void to_json(json& j, const ModelParametersSine& obj);
201 friend void from_json(const json& j, ModelParametersSine& obj);
202
203 friend void to_json(json& j, const ModelParametersSineOffset& obj);
204 friend void from_json(const json& j, ModelParametersSineOffset& obj);
205
206 friend void to_json(json& j, const ModelParametersSineCN0& obj);
207 friend void from_json(const json& j, ModelParametersSineCN0& obj);
208
209 friend void to_json(json& j, const ModelParametersRtklib& obj);
210 friend void from_json(const json& j, ModelParametersRtklib& obj);
211
212 friend void to_json(json& j, const ModelParametersSineType& obj);
213 friend void from_json(const json& j, ModelParametersSineType& obj);
214
215 friend void to_json(json& j, const ModelParametersSineSqrt& obj);
216 friend void from_json(const json& j, ModelParametersSineSqrt& obj);
217
218 friend void to_json(json& j, const ModelParametersExponential& obj);
219 friend void from_json(const json& j, ModelParametersExponential& obj);
220
221 friend void to_json(json& j, const ModelParametersCosineType& obj);
222 friend void from_json(const json& j, ModelParametersCosineType& obj);
223};
224
229
233void to_json(json& j, const GnssMeasurementErrorModel& obj);
237void from_json(const json& j, GnssMeasurementErrorModel& obj);
238
242void to_json(json& j, const GnssMeasurementErrorModel::ModelParametersSine& obj);
246void from_json(const json& j, GnssMeasurementErrorModel::ModelParametersSine& obj);
247
251void to_json(json& j, const GnssMeasurementErrorModel::ModelParametersSineOffset& obj);
255void from_json(const json& j, GnssMeasurementErrorModel::ModelParametersSineOffset& obj);
256
260void to_json(json& j, const GnssMeasurementErrorModel::ModelParametersSineCN0& obj);
264void from_json(const json& j, GnssMeasurementErrorModel::ModelParametersSineCN0& obj);
265
269void to_json(json& j, const GnssMeasurementErrorModel::ModelParametersRtklib& obj);
273void from_json(const json& j, GnssMeasurementErrorModel::ModelParametersRtklib& obj);
274
278void to_json(json& j, const GnssMeasurementErrorModel::ModelParametersSineType& obj);
282void from_json(const json& j, GnssMeasurementErrorModel::ModelParametersSineType& obj);
283
287void to_json(json& j, const GnssMeasurementErrorModel::ModelParametersSineSqrt& obj);
291void from_json(const json& j, GnssMeasurementErrorModel::ModelParametersSineSqrt& obj);
292
296void to_json(json& j, const GnssMeasurementErrorModel::ModelParametersExponential& obj);
300void from_json(const json& j, GnssMeasurementErrorModel::ModelParametersExponential& obj);
301
305void to_json(json& j, const GnssMeasurementErrorModel::ModelParametersCosineType& obj);
309void from_json(const json& j, GnssMeasurementErrorModel::ModelParametersCosineType& obj);
310
311} // namespace NAV
Array Utility functions.
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
Frequency definition for different satellite systems.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
GNSS Satellite System.
Frequency definition for different satellite systems.
Definition Frequency.hpp:59
Errors concerning GNSS observations.
Definition MeasurementErrors.hpp:31
friend void from_json(const json &j, ModelParametersSineCN0 &obj)
Converts the provided json object into a node object.
friend void to_json(json &j, const ModelParametersSineType &obj)
Converts the provided object into json.
double carrierMeasErrorVar(const SatelliteSystem &satSys, double elevation, double cn0) const
Calculates the measurement Error Variance for carrier-phase observations.
friend void from_json(const json &j, ModelParametersSineType &obj)
Converts the provided json object into a node object.
friend void to_json(json &j, const ModelParametersSineCN0 &obj)
Converts the provided object into json.
friend void from_json(const json &j, ModelParametersSine &obj)
Converts the provided json object into a node object.
GnssMeasurementErrorModel()
Default constructor.
friend void to_json(json &j, const ModelParametersExponential &obj)
Converts the provided object into json.
Model
Models.
Definition MeasurementErrors.hpp:38
@ SINE_CN0
Sine and CN0 dependent. See Groves, ch. 9.4.2.4, eq. 9.168, p. 422 (range acceleration is neglected)
Definition MeasurementErrors.hpp:42
@ SINE_TYPE
Sine Type. See King and Bock 2001.
Definition MeasurementErrors.hpp:44
@ None
Measurement error model turned off.
Definition MeasurementErrors.hpp:39
@ COUNT
Amount of items in the enum.
Definition MeasurementErrors.hpp:48
@ EXPONENTIAL
Exponential. See Euler and Goad 1991 / Li et al. 2016.
Definition MeasurementErrors.hpp:46
@ SINE
Sine. See Dach 2015.
Definition MeasurementErrors.hpp:40
@ RTKLIB
RTKLIB error model. See RTKLIB ch. E.6, eq. E.6.24, p. 162.
Definition MeasurementErrors.hpp:43
@ COSINE_TYPE
Cosine Type. See Hadas 2020 eq. 14, p. 8.
Definition MeasurementErrors.hpp:47
@ SINE_SQRT
Sine square-root. See Kiliszek 2022, table 2, p. 5.
Definition MeasurementErrors.hpp:45
@ SINE_OFFSET
Sine with offset. See Zhang 2021 eq. 7, p. 3.
Definition MeasurementErrors.hpp:41
friend void to_json(json &j, const ModelParametersSine &obj)
Converts the provided object into json.
friend void to_json(json &j, const GnssMeasurementErrorModel &obj)
Converts the provided object into json.
friend void from_json(const json &j, ModelParametersExponential &obj)
Converts the provided json object into a node object.
double codeBiasErrorVar() const
Returns the Code Bias Error Variance.
friend void to_json(json &j, const ModelParametersCosineType &obj)
Converts the provided object into json.
friend void from_json(const json &j, ModelParametersCosineType &obj)
Converts the provided json object into a node object.
friend void from_json(const json &j, ModelParametersSineSqrt &obj)
Converts the provided json object into a node object.
friend void from_json(const json &j, GnssMeasurementErrorModel &obj)
Converts the provided json object into a node object.
bool ShowGuiWidgets(const char *id, float width)
Shows a GUI widgets.
double psrRateMeasErrorVar(const Frequency &freq, int8_t num, double elevation, double cn0) const
Returns the Pseudo-range rate Error Variance.
double psrMeasErrorVar(const SatelliteSystem &satSys, double elevation, double cn0) const
Calculates the measurement Error Variance for pseudorange observations.
friend void to_json(json &j, const ModelParametersRtklib &obj)
Converts the provided object into json.
friend void from_json(const json &j, ModelParametersSineOffset &obj)
Converts the provided json object into a node object.
friend void to_json(json &j, const ModelParametersSineSqrt &obj)
Converts the provided object into json.
friend void from_json(const json &j, ModelParametersRtklib &obj)
Converts the provided json object into a node object.
friend void to_json(json &j, const ModelParametersSineOffset &obj)
Converts the provided object into json.
Satellite System type.
Definition SatelliteSystem.hpp:43