0.3.0
Loading...
Searching...
No Matches
Pressure.cpp
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#include "Pressure.hpp"
10
12#include "util/Logger.hpp"
13#include "util/Assert.h"
14
16
17namespace NAV
18{
19
20const char* to_string(PressureModel pressureModel)
21{
22 switch (pressureModel)
23 {
25 return "None";
27 return "Const p0";
29 return "ISA";
31 return "GPT2";
33 return "GPT3";
35 break;
36 }
37 return "";
38}
39
40bool ComboPressureModel(const char* label, PressureModel& pressureModel)
41{
42 return gui::widgets::EnumCombo(label, pressureModel);
43}
44
45double calcTotalPressure(double altitudeMSL, PressureModel pressureModel)
46{
47 switch (pressureModel)
48 {
50 return calcTotalPressureStAtm(0);
52 return calcTotalPressureStAtm(altitudeMSL);
55 LOG_CRITICAL("GPT2/GPT3 Model needs to be called separately because of parameter lookup.");
56 break;
59 break;
60 }
61
62 return 0.0;
63}
64
65} // namespace NAV
Assertion helpers.
Combo representing an enumeration.
Utility class for logging to console and file.
#define LOG_CRITICAL(...)
Critical Event, which causes the program to work entirely and throws an exception.
Definition Logger.hpp:75
Standard Atmosphere pressure model.
Pressure calculation formulas.
bool EnumCombo(const char *label, T &enumeration, size_t startIdx=0)
Combo representing an enumeration.
Definition EnumCombo.hpp:30
PressureModel
Available pressure Models.
Definition Pressure.hpp:24
@ ConstNN
Constant value at zero altitude.
Definition Pressure.hpp:26
@ COUNT
Amount of items in the enum.
Definition Pressure.hpp:30
@ ISA
ICAO Standard Atmosphere.
Definition Pressure.hpp:27
@ None
No pressure model.
Definition Pressure.hpp:25
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
constexpr double calcTotalPressureStAtm(double altitudeMSL)
Calculates the standard atmosphere total pressure.
bool ComboPressureModel(const char *label, PressureModel &pressureModel)
Shows a ComboBox to select the pressure model.
Definition Pressure.cpp:40