Browse Source

update tests

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

8
tests/orbit_test.cpp

@ -24,8 +24,8 @@ TEST_CASE("orbit propagation", "[orbits]")
double mu = 398601.68; // NOTE: gravitational parameter
double r = 6378; // NOTE: body radius in km
double initial_anom = 260 * M_PI / 180; // NOTE: radians
double time_step = 60 * 50; // NOTE: seconds
system_2body sys = systemInit(gravBodyInit(mu, r), orbitInit(a, e));
sys.time_step = 60 * 50; // NOTE: seconds
double E1 = getEccAnomFromTrueAnom(sys.ep.e, initial_anom);
REQUIRE_THAT(E1, WithinAbs(-0.8615, 1e-4));
@ -36,17 +36,17 @@ TEST_CASE("orbit propagation", "[orbits]")
double n = getMeanMotion(sys.body.mu, sys.ep.a);
REQUIRE_THAT(n, WithinAbs(0.00014582, 1e-8));
double M2 = getPropagatedMeanAnom(M1, n, sys.time_step);
double M2 = getPropagatedMeanAnom(M1, n, time_step);
REQUIRE_THAT(M2, WithinAbs(0.1383, 1e-5));
// TODO: could also test for the other trial values listed in table 4.1
double E2_1 = getInitialTrialValue(M2, sys.ep.e);
REQUIRE_THAT(E2_1, WithinAbs(0.315452, 1e-5));
double ecc_anom = getPropagatedEccAnomaly(sys, initial_anom);
double ecc_anom = getPropagatedEccAnomaly(sys, initial_anom, time_step);
REQUIRE_THAT(ecc_anom, WithinAbs(0.481518, 1e-5));
double true_anom = getPropagatedTrueAnomaly(sys, initial_anom);
double true_anom = getPropagatedTrueAnomaly(sys, initial_anom, time_step);
REQUIRE_THAT(true_anom, WithinAbs(1.1339, 1e-4));
double r2 = orbitGetRadialDistance(sys.ep.e, sys.ep.p, true_anom);

Loading…
Cancel
Save