0.5.0
Loading...
Searching...
No Matches
Pressure.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 Pressure.hpp
10/// @brief Pressure calculation formulas
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 pressure Models
23enum class PressureModel : uint8_t
24{
25 None, ///< No pressure model
26 ConstNN, ///< Constant value at zero altitude
27 ISA, ///< ICAO Standard Atmosphere
28 GPT2, ///< GPT2
29 GPT3, ///< GPT3
30 COUNT, ///< Amount of items in the enum
31};
32
33/// @brief Converts the enum to a string
34/// @param[in] pressureModel Enum value to convert into text
35/// @return String representation of the enum
36const char* to_string(PressureModel pressureModel);
37
38/// @brief Shows a ComboBox to select the pressure model
39/// @param[in] label Label to show beside the combo box. This has to be a unique id for ImGui.
40/// @param[in] pressureModel Reference to the pressure model to select
41bool ComboPressureModel(const char* label, PressureModel& pressureModel);
42
43/// @brief Calculates the total pressure
44/// @param[in] altitudeMSL Geodetic height above MSL (mean sea level) [m]
45/// @param[in] pressureModel Pressure model to use
46/// @return The total pressure in [hPa] = [mbar]
47[[nodiscard]] double calcTotalPressure(double altitudeMSL, PressureModel pressureModel);
48
49} // namespace NAV
50
51#ifndef DOXYGEN_IGNORE
52
53/// @brief Formatter
54template<>
55struct fmt::formatter<NAV::PressureModel> : 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::PressureModel& data, FormatContext& ctx) const
63 {
64 return fmt::formatter<std::string>::format(NAV::to_string(data), ctx);
65 }
66};
67
68#endif
PressureModel
Available pressure Models.
Definition Pressure.hpp:24
@ ConstNN
Constant value at zero altitude.
Definition Pressure.hpp:26
@ 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.
double calcTotalPressure(double altitudeMSL, PressureModel pressureModel)
Calculates the total pressure.
Definition Pressure.cpp:45
bool ComboPressureModel(const char *label, PressureModel &pressureModel)
Shows a ComboBox to select the pressure model.
Definition Pressure.cpp:40