def test_convert_coe_to_rv(self): # Data from Vallado, example 2.6 p = 11067.790 ecc = 0.83285 inc = radians(87.87) raan = radians(227.89) argp = radians(53.38) ta = radians(92.335) expected_position = [6525.344, 6861.535, 6449.125] expected_velocity = [4.902276, 5.533124, -1.975709] position, velocity = coe2rv(MU_E, p, ecc, inc, raan, argp, ta) assert_allclose(position, expected_position, rtol=1e-5) assert_allclose(velocity, expected_velocity, rtol=1e-5)
def kepler(argp, delta_t_sec, ecc, inc, p, raan, sma, ta): # Initial mean anomaly M_0 = ta_to_M(ta, ecc) # Mean motion n = sqrt(wgs84.mu / sma**3) # Propagation M = M_0 + n * delta_t_sec # New true anomaly ta = M_to_ta(M, ecc) # Position and velocity vectors position_eci, velocity_eci = coe2rv(MU_E, p, ecc, inc, raan, argp, ta) return position_eci, velocity_eci
def pkepler(argp, delta_t_sec, ecc, inc, p, raan, sma, ta): """Perturbed Kepler problem (only J2) Notes ----- Based on algorithm 64 of Vallado 3rd edition """ # Mean motion n = sqrt(MU_E / sma**3) # Initial mean anomaly M_0 = ta_to_M(ta, ecc) # Update for perturbations delta_raan = (-(3 * n * R_E_KM**2 * J2) / (2 * p**2) * cos(inc) * delta_t_sec) raan = raan + delta_raan delta_argp = ((3 * n * R_E_KM**2 * J2) / (4 * p**2) * (4 - 5 * sin(inc)**2) * delta_t_sec) argp = argp + delta_argp M0_dot = ((3 * n * R_E_KM**2 * J2) / (4 * p**2) * (2 - 3 * sin(inc)**2) * sqrt(1 - ecc**2)) M_dot = n + M0_dot # Propagation M = M_0 + M_dot * delta_t_sec # New true anomaly ta = M_to_ta(M, ecc) # Position and velocity vectors position_eci, velocity_eci = coe2rv(MU_E, p, ecc, inc, raan, argp, ta) return position_eci, velocity_eci