0.5.0
Loading...
Searching...
No Matches
Troposphere.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 Troposphere.hpp
10/// @brief Troposphere Models
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @author Rui Wang (rui.wang@ins.uni-stuttgart.de)
13/// @date 2022-05-26
14
15#pragma once
16
17#include <array>
18#include <Eigen/Core>
19#include <fmt/format.h>
20
21#include "ZenithDelay.hpp"
27
28namespace NAV
29{
30
31/// @brief Atmospheric model selection for temperature, pressure and water vapor
38
39/// Available Troposphere delay models
40enum class TroposphereModel : uint8_t
41{
42 None, ///< Troposphere Model turned off
43 Saastamoinen, ///< Saastamoinen model
44 GPT2, ///< GPT2
45 GPT3, ///< GPT3
46 COUNT, ///< Amount of items in the enum
47};
48
49/// Available Mapping Functions
50enum class MappingFunction : uint8_t
51{
52 None, ///< Mapping Function turned off (= 1)
53 Cosecant, ///< Cosecant of elevation
54 GMF, ///< Global Mapping Function (GMF)
55 NMF, ///< Niell Mapping Function (NMF)
56 VMF_GPT2, ///< Vienna Mapping Function based on the GPT2 grid
57 VMF_GPT3, ///< Vienna Mapping Function based on the GPT3 grid
58 COUNT, ///< Amount of items in the enum
59};
60
61/// @brief Collection of troposphere model selections
63{
64 /// Troposphere ZHD model, atmosphere models
65 std::pair<TroposphereModel, AtmosphereModels> zhdModel = std::make_pair(TroposphereModel::Saastamoinen, AtmosphereModels{});
66 /// Troposphere ZWD model, atmosphere models
67 std::pair<TroposphereModel, AtmosphereModels> zwdModel = std::make_pair(TroposphereModel::Saastamoinen, AtmosphereModels{});
68
69 /// Mapping function ZHD, atmosphere models
70 std::pair<MappingFunction, AtmosphereModels> zhdMappingFunction = std::make_pair(MappingFunction::GMF, AtmosphereModels{});
71 /// Mapping function ZWD, atmosphere models
72 std::pair<MappingFunction, AtmosphereModels> zwdMappingFunction = std::make_pair(MappingFunction::GMF, AtmosphereModels{});
73};
74
75/// @brief Converts the enum to a string
76/// @param[in] troposphereZhdModel Enum value to convert into text
77/// @return String representation of the enum
78const char* to_string(TroposphereModel troposphereZhdModel);
79
80/// @brief Converts the enum to a string
81/// @param[in] mappingFunction Enum value to convert into text
82/// @return String representation of the enum
83const char* to_string(MappingFunction mappingFunction);
84
85/// @brief Shows a ComboBox and button for advanced configuration to select the troposphere models
86/// @param[in] label Label to show beside the combo box. This has to be a unique id for ImGui.
87/// @param[in] troposphereModelSelection Reference to the troposphere model to select
88/// @param[in] width Width of the widget
89bool ComboTroposphereModel(const char* label, TroposphereModelSelection& troposphereModelSelection, float width = 0.0F);
90
91/// @brief Calculates the tropospheric zenith hydrostatic and wet delays and corresponding mapping factors
92/// @param[in] insTime Time to calculate the values for
93/// @param[in] lla_pos [𝜙, λ, h]^T Geodetic latitude, longitude and height in [rad, rad, m]
94/// @param[in] elevation Satellite elevation [rad]
95/// @param[in] azimuth Satellite azimuth [rad]
96/// @param[in] troposphereModels Models to use for each calculation
97/// @param[in] nameId Name and Id of the node used for log messages only
98/// @return ZHD, ZWD and mapping factors for ZHD and ZWD
99ZenithDelay calcTroposphericDelayAndMapping(const InsTime& insTime, const Eigen::Vector3d& lla_pos, double elevation, double azimuth,
100 const TroposphereModelSelection& troposphereModels, const std::string& nameId);
101
102/// @brief Calculates the tropospheric error variance
103/// @param[in] dpsr_T Tropospheric propagation error [m]
104/// @param[in] elevation Satellite elevation in [rad]
105/// @return Variance of the error [m^2]
106double tropoErrorVar(double dpsr_T, double elevation);
107
108/// @brief Converts the provided object into json
109/// @param[out] j Json object which gets filled with the info
110/// @param[in] obj Object to convert into json
111void to_json(json& j, const AtmosphereModels& obj);
112/// @brief Converts the provided json object into a node object
113/// @param[in] j Json object with the needed values
114/// @param[out] obj Object to fill from the json
115void from_json(const json& j, AtmosphereModels& obj);
116
117/// @brief Converts the provided object into json
118/// @param[out] j Json object which gets filled with the info
119/// @param[in] obj Object to convert into json
120void to_json(json& j, const TroposphereModelSelection& obj);
121/// @brief Converts the provided json object into a node object
122/// @param[in] j Json object with the needed values
123/// @param[out] obj Object to fill from the json
124void from_json(const json& j, TroposphereModelSelection& obj);
125
126} // namespace NAV
127
128#ifndef DOXYGEN_IGNORE
129
130/// @brief Formatter
131template<>
132struct fmt::formatter<NAV::TroposphereModel> : fmt::formatter<std::string>
133{
134 /// @brief Defines how to format structs
135 /// @param[in] data Struct to format
136 /// @param[in, out] ctx Format context
137 /// @return Output iterator
138 template<typename FormatContext>
139 auto format(const NAV::TroposphereModel& data, FormatContext& ctx) const
140 {
141 return fmt::formatter<std::string>::format(NAV::to_string(data), ctx);
142 }
143};
144
145/// @brief Formatter
146template<>
147struct fmt::formatter<NAV::MappingFunction> : fmt::formatter<std::string>
148{
149 /// @brief Defines how to format structs
150 /// @param[in] data Struct to format
151 /// @param[in, out] ctx Format context
152 /// @return Output iterator
153 template<typename FormatContext>
154 auto format(const NAV::MappingFunction& data, FormatContext& ctx) const
155 {
156 return fmt::formatter<std::string>::format(NAV::to_string(data), ctx);
157 }
158};
159
160#endif
nlohmann::json json
json namespace
The class is responsible for all time-related tasks.
Pressure calculation formulas.
Temperature calculation formulas.
Gridded Vienna Mapping Function.
Water vapor calculation.
Zenith hydrostatic and wet delay.
Temperature Model parameters.
@ ISA
ICAO Standard Atmosphere.
void to_json(json &j, const Node &node)
Converts the provided node into a json object.
Definition Node.cpp:990
PressureModel
Available pressure Models.
Definition Pressure.hpp:24
@ ISA
ICAO Standard Atmosphere.
Definition Pressure.hpp:27
bool ComboTroposphereModel(const char *label, TroposphereModelSelection &troposphereModelSelection, float width)
Shows a ComboBox and button for advanced configuration to select the troposphere models.
@ COUNT
Amount of items in the enum.
@ None
Ionosphere model turned off.
MappingFunction
Available Mapping Functions.
@ NMF
Niell Mapping Function (NMF)
@ GMF
Global Mapping Function (GMF)
@ Cosecant
Cosecant of elevation.
@ VMF_GPT2
Vienna Mapping Function based on the GPT2 grid.
@ VMF_GPT3
Vienna Mapping Function based on the GPT3 grid.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
double tropoErrorVar(double dpsr_T, double elevation)
Calculates the tropospheric error variance.
WaterVaporModel
Available Water vapor Models.
@ ISA
ICAO Standard Atmosphere.
void from_json(const json &j, Node &node)
Converts the provided json object into a node object.
Definition Node.cpp:1007
ZenithDelay calcTroposphericDelayAndMapping(const InsTime &insTime, const Eigen::Vector3d &lla_pos, double elevation, double, const TroposphereModelSelection &troposphereModels, const std::string &nameId)
Calculates the tropospheric zenith hydrostatic and wet delays and corresponding mapping factors.
TroposphereModel
Available Troposphere delay models.
@ Saastamoinen
Saastamoinen model.
Atmospheric model selection for temperature, pressure and water vapor.
TemperatureModel temperatureModel
Temperature model.
PressureModel pressureModel
Pressure model.
WaterVaporModel waterVaporModel
WaterVapor model.
Collection of troposphere model selections.
std::pair< MappingFunction, AtmosphereModels > zwdMappingFunction
Mapping function ZWD, atmosphere models.
std::pair< TroposphereModel, AtmosphereModels > zwdModel
Troposphere ZWD model, atmosphere models.
std::pair< TroposphereModel, AtmosphereModels > zhdModel
Troposphere ZHD model, atmosphere models.
std::pair< MappingFunction, AtmosphereModels > zhdMappingFunction
Mapping function ZHD, atmosphere models.