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 test_true_to_mean(self): # Data from Schlesinger & Udick, 1912 data = [ # ecc, M (deg), ta (deg) (0.0, 0.0, 0.0), (0.05, 10.0, 11.06), (0.06, 30.0, 33.67), (0.04, 120.0, 123.87), (0.14, 65.0, 80.50), (0.19, 21.0, 30.94), (0.35, 65.0, 105.71), (0.48, 180.0, 180.0), (0.75, 125.0, 167.57) ] for row in data: ecc, expected_M, ta = row M = angles.ta_to_M(radians(ta), ecc) self.assertAlmostEqual(degrees(M), expected_M, places=1)
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