0.4.1
Loading...
Searching...
No Matches
WaterVapor.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 WaterVapor.hpp
10/// @brief Water vapor calculation
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2023-01-31
13
14#pragma once
15
16#include <cstdint>
17#include <fmt/format.h>
18
19namespace NAV
20{
21
22/// Available Water vapor Models
23enum class WaterVaporModel : uint8_t
24{
25 None, ///< Water vapor model turned off
26 ISA, ///< ICAO Standard Atmosphere
27 GPT2, ///< GPT2
28 GPT3, ///< GPT3
29 COUNT, ///< Amount of items in the enum
30};
31
32/// @brief Converts the enum to a string
33/// @param[in] waterVaporModel Enum value to convert into text
34/// @return String representation of the enum
35const char* to_string(WaterVaporModel waterVaporModel);
36
37/// @brief Shows a ComboBox to select the water vapor model
38/// @param[in] label Label to show beside the combo box. This has to be a unique id for ImGui.
39/// @param[in] waterVaporModel Reference to the water vapor model to select
40bool ComboWaterVaporModel(const char* label, WaterVaporModel& waterVaporModel);
41
42/// @brief Calculates the partial pressure of water vapor
43/// @param[in] temp The absolute temperature in [K]
44/// @param[in] humidity_rel The relative humidity
45/// @param[in] waterVaporModel Water vapor model to use
46/// @return The partial pressure [hPa] of water vapor
47[[nodiscard]] double calcWaterVaporPartialPressure(double temp, double humidity_rel, WaterVaporModel waterVaporModel);
48
49} // namespace NAV
50
51#ifndef DOXYGEN_IGNORE
52
53/// @brief Formatter
54template<>
55struct fmt::formatter<NAV::WaterVaporModel> : fmt::formatter<std::string>
56{
57 /// @brief Defines how to format structs
58 /// @param[in] data Struct to format
59 /// @param[in, out] ctx Format context
60 /// @return Output iterator
61 template<typename FormatContext>
62 auto format(const NAV::WaterVaporModel& data, FormatContext& ctx) const
63 {
64 return fmt::formatter<std::string>::format(NAV::to_string(data), ctx);
65 }
66};
67
68#endif
@ ISA
ICAO Standard Atmosphere.
Definition Pressure.hpp:27
@ COUNT
Amount of items in the enum.
@ None
Ionosphere model turned off.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
WaterVaporModel
Available Water vapor Models.
bool ComboWaterVaporModel(const char *label, WaterVaporModel &waterVaporModel)
Shows a ComboBox to select the water vapor model.
double calcWaterVaporPartialPressure(double temp, double humidity_rel, WaterVaporModel waterVaporModel)
Calculates the partial pressure of water vapor.