0.4.1
Loading...
Searching...
No Matches
IonosphericCorrections.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
9/// @file IonosphericCorrections.hpp
10/// @brief Ionospheric Correction data
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2022-05-07
13
14#pragma once
15
16#include <cstdint>
17#include <vector>
18#include <optional>
19#include <functional>
20
22
23namespace NAV
24{
25
26/// GNSS Navigation message information
27class GnssNavInfo;
28
29/// @brief Ionospheric Corrections
31{
32 public:
33 /// @brief Alpha or beta values
34 enum AlphaBeta : uint8_t
35 {
36 Alpha, ///< Coefficients of a cubic equation representing the amplitude of the vertical delay
37 Beta, ///< Coefficients of a cubic equation representing the period of the model
38 };
39
40 /// @brief Ionospheric Corrections Data Storage
42 {
43 SatelliteSystem satSys = SatSys_None; ///< Satellite System (e.g. GPS, GAL, GLO, ...)
44 AlphaBeta alphaBeta = Alpha; ///< Alpha or beta value
45 std::array<double, 4> data{}; ///< Data storage (3 values for GAL, otherwise 4) [s, s/semi-circle, s/semi-circle^2, s/semi-circle^3]
46 };
47
48 /// @brief Default constructor
50
51 /// @brief Constructor which collects the ionospheric parameters from the Navigation infos
52 /// @param[in] gnssNavInfos List of GNSS navigation infos
53 explicit IonosphericCorrections(const std::vector<const GnssNavInfo*>& gnssNavInfos);
54
55 /// @brief Constructor from raw corrections
56 /// @param corrections Corrections vector
57 IonosphericCorrections(std::vector<Corrections> corrections); // NOLINT(hicpp-explicit-conversions, google-explicit-constructor)
58
59 /// @brief Get the Ionospheric Correction values
60 /// @param[in] satSys Satellite System to search the value for
61 /// @param[in] alphaBeta Alpha or beta values (Galileo only alpha)
62 /// @return List with the correction values (3 for GAL, otherwise 4)
63 [[nodiscard]] const std::array<double, 4>* get(SatelliteSystem satSys, AlphaBeta alphaBeta) const
64 {
65 auto iter = std::ranges::find_if(m_ionosphericCorrections, [satSys, alphaBeta](const Corrections& c) {
66 return c.satSys == satSys && c.alphaBeta == alphaBeta;
67 });
68 if (iter != m_ionosphericCorrections.end())
69 {
70 return &iter->data;
71 }
72 return nullptr;
73 }
74
75 /// @brief Checks whether the data is in the internal storage
76 /// @param[in] satSys Satellite System to search the value for
77 /// @param[in] alphaBeta Alpha or beta values (Galileo only alpha)
78 [[nodiscard]] bool contains(SatelliteSystem satSys, AlphaBeta alphaBeta) const
79 {
80 auto iter = std::ranges::find_if(m_ionosphericCorrections, [satSys, alphaBeta](const Corrections& c) {
81 return c.satSys == satSys && c.alphaBeta == alphaBeta;
82 });
83 return iter != m_ionosphericCorrections.end();
84 }
85
86 /// @brief Returns the internal data storage
87 [[nodiscard]] const std::vector<Corrections>& data() const
88 {
90 }
91
92 /// @brief Inserts new data into the m_ionosphericCorrections variable
93 /// @param[in] satSys Satellite System to search the value for
94 /// @param[in] alphaBeta Alpha or beta values (Galileo only alpha)
95 /// @param[in] values Values to add [s, s/semi-circle, s/semi-circle^2, s/semi-circle^3]
96 void insert(SatelliteSystem satSys, AlphaBeta alphaBeta, const std::array<double, 4>& values)
97 {
98 auto iter = std::ranges::find_if(m_ionosphericCorrections, [satSys, alphaBeta](const Corrections& c) {
99 return c.satSys == satSys && c.alphaBeta == alphaBeta;
100 });
101 if (iter == m_ionosphericCorrections.end())
102 {
103 m_ionosphericCorrections.push_back({ satSys, alphaBeta, values });
104 }
105 else
106 {
107 iter->data = values;
108 }
109 }
110
111 /// @brief Empties the data
112 void clear()
113 {
115 }
116
117 private:
118 /// @brief Ionospheric correction values
119 std::vector<Corrections> m_ionosphericCorrections;
120};
121
122} // namespace NAV
GNSS Satellite System.
GNSS Navigation message information.
bool contains(SatelliteSystem satSys, AlphaBeta alphaBeta) const
Checks whether the data is in the internal storage.
const std::vector< Corrections > & data() const
Returns the internal data storage.
@ Beta
Coefficients of a cubic equation representing the period of the model.
@ Alpha
Coefficients of a cubic equation representing the amplitude of the vertical delay.
const std::array< double, 4 > * get(SatelliteSystem satSys, AlphaBeta alphaBeta) const
Get the Ionospheric Correction values.
std::vector< Corrections > m_ionosphericCorrections
Ionospheric correction values.
IonosphericCorrections()=default
Default constructor.
void insert(SatelliteSystem satSys, AlphaBeta alphaBeta, const std::array< double, 4 > &values)
Inserts new data into the m_ionosphericCorrections variable.
@ SatSys_None
No Satellite system.
Ionospheric Corrections Data Storage.
std::array< double, 4 > data
Data storage (3 values for GAL, otherwise 4) [s, s/semi-circle, s/semi-circle^2, s/semi-circle^3].
SatelliteSystem satSys
Satellite System (e.g. GPS, GAL, GLO, ...)
Satellite System type.