Browse Source

add orbit determination test case for flight path angle

main
cinnaboot 4 years ago
parent
commit
8a05d11390
  1. 30
      tests/orbit_test.cpp

30
tests/orbit_test.cpp

@ -44,6 +44,36 @@ TEST_CASE("orbit determination, example 2.1", "[orbits]")
REQUIRE_THAT(e, WithinAbs(0.4024, 1e-4));
}
TEST_CASE("Chandra X-ray Observatory orbit, example 2.3", "[orbits]")
{
double r_periapsis = 20686;
double r_apoapsis = 140906;
double mu = EARTH_GRAVITATIONAL_PARAMETER;
EllipseParameters ep = ellipseInitAE(
(r_periapsis + r_apoapsis) / 2,
(r_apoapsis - r_periapsis) / (r_periapsis + r_apoapsis));
double a = ep.a, e = ep.e, p = ep.p;
REQUIRE_THAT(a, WithinAbs(80796, 1));
REQUIRE_THAT(e, WithinAbs(0.7440, 1e-4));
REQUIRE_THAT(p, WithinAbs(36075.81, 1e-2));
double h = orbitGetAngularMomentum(p, mu);
REQUIRE_THAT(h, WithinAbs(119915.89, 0.5));
double epsilon = orbitGetSpecificEnergy(a, mu);
REQUIRE_THAT(epsilon, WithinAbs(-2.4667, 1e-4));
double theta = DEG2RAD(120);
double r_theta = orbitGetRadialDistance(e, p, theta);
REQUIRE_THAT(r_theta, WithinAbs(57444.31, 1e-2));
double v_theta = orbitGetVelocity(epsilon, mu, r_theta);
REQUIRE_THAT(v_theta, WithinAbs(2.9907, 1e-4));
double gamma = orbitGetFlightPathAngle(e, theta);
REQUIRE_THAT(gamma, WithinAbs(DEG2RAD(45.73), 1e-2));
}
TEST_CASE("state vectors to orbital elements, example 3.1", "[orbits]")
{
double mu = EARTH_GRAVITATIONAL_PARAMETER;

Loading…
Cancel
Save