sta-models/include/sta/models/altitude.hpp
2024-06-21 18:20:06 +02:00

59 lines
2.3 KiB
C++

#ifndef INC_MODELS_ALTITUDE_
#define INC_MODELS_ALTITUDE_
#include <sta/math/probability/randomVariable.hpp>
namespace sta
{
namespace models {
class BarometricFormula
{
/**
* @brief Get the altitude from the pressure using the barometric formula. The model is valid for altitudes up to leat 9 km.
*
* @param p Pressure in hPa
* @return Altitude in meters
*/
public:
/*
* @brief Constructor for the Barometric Formula
* @param pRef Reference pressure in hPa
* @param hRef Reference altitude in meters
*/
BarometricFormula(float pRef = 1013.25, float hRef = 0);
/*
* @brief Get the altitude from the pressure using the barometric formula
* @param p Pressure in hPa
* @return Altitude in meters
*/
float getAltitude(float p);
private:
float p0_;
};
namespace USSA1976
{
/**
* @brief Get the altitude from the pressure using the U.S. Standard Atmosphere 1976 model (https://ntrs.nasa.gov/search.jsp?R=19770009539)
* and the barometric formula for multiple layers. The model is valid for altitudes up to at leat 71 km. See https://en.wikipedia.org/wiki/Barometric_formula for more information.
*
* @param p Pressure in hPa
* @return Altitude in meters
*/
float getAltitude(float p);
/**
* @brief Get the altitude as Gaussian Random Variable from the pressure as Gaussian Random Variable using the U.S. Standard Atmosphere 1976 model (https://ntrs.nasa.gov/search.jsp?R=19770009539)
* and the barometric formula for multiple layers. The model is valid for altitudes up to at leat 71 km. See https://en.wikipedia.org/wiki/Barometric_formula for more information.
*
* @param p Pressure in hPa as a Gaussian Random Variable
* @return Altitude in meters as a Gaussian Random Variable
*/
sta::math::probability::grv getAltitude(sta::math::probability::grv p);
} // namespace USSA1976
} // namespace models
} // namespace sta
#endif //INC_MODELS_ALTITUDE_