24#include "internal/egm96Coeffs.hpp"
56template<
typename Scalar,
typename = std::enable_if_t<std::is_
floating_po
int_v<Scalar>>>
60 auto g_0 = 9.7803253359 * (1.0 + 1.931853e-3 * std::pow(std::sin(latitude), 2))
71 return { 0.0, 0.0, k * g_0 };
81template<
typename Scalar,
typename = std::enable_if_t<std::is_
floating_po
int_v<Scalar>>>
94 return { 0, 0, gravitationMagnitude };
104template<
typename Scalar,
typename = std::enable_if_t<std::is_
floating_po
int_v<Scalar>>>
117 return { 0, 0, gravitationMagnitude };
127template<
typename Derived>
128[[nodiscard]] Eigen::Vector3<typename Derived::Scalar>
n_calcGravitation_EGM96(
const Eigen::MatrixBase<Derived>& lla_position,
size_t ndegree = 10)
133 auto e_position = trafo::lla2ecef_WGS84(lla_position);
136 auto latitudeGeocentric = std::atan(e_position(2) / std::sqrt(e_position(0) * e_position(0) + e_position(1) * e_position(1)));
139 auto radius = std::sqrt(e_position(0) * e_position(0) + e_position(1) * e_position(1) + e_position(2) * e_position(2));
140 auto elevation = M_PI_2 - latitudeGeocentric;
141 auto azimuth = lla_position(1);
144 Eigen::Vector3<typename Derived::Scalar> n_gravitation = Eigen::Vector3<typename Derived::Scalar>::Zero();
146 typename Derived::Scalar Pnm = 0;
147 typename Derived::Scalar Pnmd = 0;
149 auto coeffsRows = egm96Coeffs.size();
152 auto [P, Pd] = associatedLegendre(
static_cast<double>(elevation), ndegree);
154 for (
size_t i = 0; i < coeffsRows; i++)
157 auto n =
static_cast<int>(egm96Coeffs.at(i).at(0));
158 auto m =
static_cast<int>(egm96Coeffs.at(i).at(1));
159 auto C = egm96Coeffs.at(i).at(2);
160 auto S = egm96Coeffs.at(i).at(3);
162 if (
static_cast<size_t>(n) == ndegree + 1)
173 auto nd =
static_cast<double>(n);
174 auto md =
static_cast<double>(m);
192template<
typename Derived>
193[[nodiscard]] Eigen::Vector3<typename Derived::Scalar>
n_calcGravitation(
const Eigen::MatrixBase<Derived>& lla_position,
196 const typename Derived::Scalar& latitude = lla_position(0);
197 const typename Derived::Scalar& altitude = lla_position(2);
199 if (gravitationModel == GravitationModel::WGS84)
203 if (gravitationModel == GravitationModel::WGS84_Skydel)
207 if (gravitationModel == GravitationModel::Somigliana)
211 if (gravitationModel == GravitationModel::EGM96)
215 return Eigen::Vector3<typename Derived::Scalar>::Zero();
Associated Legendre Polynomials for EGM96.
Transformation collection.
@ None
None.
Definition GlobalActions.hpp:19
Eigen::Vector3< Scalar > n_calcGravitation_WGS84_Skydel(const Scalar &latitude, const Scalar &altitude)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...
Definition Gravity.hpp:82
Eigen::Vector3< typename Derived::Scalar > n_calcGravitation(const Eigen::MatrixBase< Derived > &lla_position, GravitationModel gravitationModel=GravitationModel::EGM96)
Calculates the gravitation (acceleration due to mass attraction of the Earth)
Definition Gravity.hpp:193
GravitationModel
Available Gravitation Models.
Definition Gravity.hpp:30
@ WGS84_Skydel
World Geodetic System 1984 implemented by the Skydel Simulator // FIXME: Remove after Skydel uses the...
@ WGS84
World Geodetic System 1984.
@ EGM96
Earth Gravitational Model 1996.
@ Somigliana
Somigliana gravity model.
bool ComboGravitationModel(const char *label, GravitationModel &gravitationModel)
Shows a ComboBox to select the gravitation model.
Eigen::Vector3< Scalar > n_calcGravitation_WGS84(const Scalar &latitude, const Scalar &altitude)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...
Definition Gravity.hpp:105
Eigen::Vector3< typename Derived::Scalar > n_calcGravitation_EGM96(const Eigen::MatrixBase< Derived > &lla_position, size_t ndegree=10)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...
Definition Gravity.hpp:128
Eigen::Vector3< Scalar > n_calcGravitation_SomiglianaAltitude(const Scalar &latitude, const Scalar &altitude)
Calculates the gravitation (acceleration due to mass attraction of the Earth) at the WGS84 reference ...
Definition Gravity.hpp:57
@ COUNT
Amount of items in the enum.
Utility class for logging to console and file.
Constants.
Definition Constants.hpp:26
static const std::array< std::array< double, 6 >, 65338 > egm96Coeffs
EGM96 coefficients.
Definition egm96Coeffs.hpp:22
std::pair< Eigen::MatrixXd, Eigen::MatrixXd > associatedLegendre(double theta, size_t ndegree=10)
Calculates the associated Legendre Polynomial coefficients necessary for the EGM96.