0.3.0
Loading...
Searching...
No Matches
WaterVapor.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 "WaterVapor.hpp"
10
12#include "util/Logger.hpp"
13#include "util/Assert.h"
14
16
17namespace NAV
18{
19
20const char* to_string(WaterVaporModel waterVaporModel)
21{
22 switch (waterVaporModel)
23 {
25 return "None";
27 return "ISA";
29 return "GPT2";
31 return "GPT3";
33 break;
34 }
35 return "";
36}
37
38bool ComboWaterVaporModel(const char* label, WaterVaporModel& waterVaporModel)
39{
40 return gui::widgets::EnumCombo(label, waterVaporModel);
41}
42
43double calcWaterVaporPartialPressure(double temp, double humidity_rel, WaterVaporModel waterVaporModel)
44{
45 switch (waterVaporModel)
46 {
48 return calcWaterVaporPartialPressureStAtm(temp, humidity_rel);
51 INS_ASSERT_USER_ERROR(waterVaporModel != WaterVaporModel::GPT2, "GPT2 Model needs to be called separately because of parameter lookup.");
52 INS_ASSERT_USER_ERROR(waterVaporModel != WaterVaporModel::GPT3, "GPT3 Model needs to be called separately because of parameter lookup.");
53 break;
56 break;
57 }
58
59 return 0.0;
60}
61
62} // namespace NAV
Assertion helpers.
#define INS_ASSERT_USER_ERROR(_EXP, _MSG)
Assert function with message.
Definition Assert.h:21
Combo representing an enumeration.
Utility class for logging to console and file.
Standard Atmosphere water vapor model.
Water vapor calculation.
bool EnumCombo(const char *label, T &enumeration, size_t startIdx=0)
Combo representing an enumeration.
Definition EnumCombo.hpp:30
constexpr double calcWaterVaporPartialPressureStAtm(double temp, double humidity_rel)
Calculates the standard atmosphere partial pressure of water vapor.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
WaterVaporModel
Available Water vapor Models.
@ COUNT
Amount of items in the enum.
@ ISA
ICAO Standard Atmosphere.
@ None
Water vapor model turned off.
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.