class TestHohmannCircular(): r1 = constants.earth.orbit_sma r2 = constants.neptune.orbit_sma ecc1, ecc2 = 0, 0 nu1, nu2 = 0, np.pi mu = constants.sun.mu dv1_true, dv2_true, tof_true, phase_angle_true = 11.65413, 4.05359, 9.66154e8, np.deg2rad(113.153) dv1, dv2, tof, phase = maneuver.hohmann(r1, r2, ecc1, ecc2, nu1, nu2, mu) def test_dv1(self): np.testing.assert_allclose(self.dv1, self.dv1_true, rtol=1e-4) def test_dv2(self): np.testing.assert_allclose(self.dv2, self.dv2_true, rtol=1e-4) def test_tof(self): np.testing.assert_allclose(self.tof, self.tof_true, rtol=1e-4) def test_tof(self): np.testing.assert_allclose(self.phase, self.phase_angle_true, rtol=1e-4)
dv_bielliptical = dv1 + dv2 + dv3 tof_bielliptical = np.pi * (np.sqrt(ab1**3 / mu) + np.sqrt(ab2**3 / mu)) print('V1 : {} km/sec'.format(v1)) print('V2 : {} km/sec'.format(v2)) print('\nBielliptical transfer') print('VT1a : {} km/sec'.format(vb1)) print('DV1 : {} km/sec'.format(dv1)) print('\nVT2a : {} km/sec'.format(vb1i)) print('VT2b : {} km/sec'.format(vb2i)) print('DV2 : {} km/sec'.format(dv2)) print('\nVT3b : {} km/sec'.format(vb2)) print('DV3 : {} km/sec'.format(dv3)) print('\nTOF : {} sec'.format(tof_bielliptical)) # hohmann transfer at, pt, ecct = kepler.perapo2aecc(r1, r2) vt1 = maneuver.vel_mag(r1, at, mu) vt2 = maneuver.vel_mag(r2, at, mu) dv1, dv2, tof, _ = maneuver.hohmann(r1, r2, 0, 0, 0, np.pi, mu) print('\nHohmann Transfer') print('VT1 : {} km/sec'.format(vt1)) print('VT2 : {} km/sec'.format(vt2)) print('DV1 : {} km/sec'.format(dv1)) print('DV2 : {} km/sec'.format(dv2)) print('TOF : {} sec'.format(tof))
ra = 7000 rb = 14000 mu = constants.earth.mu # define hyperbolic arrival orbit va1 = 12 e_h = va1**2 / 2 - mu / ra a_h = -mu / e_h / 2 ecc_h = ra / np.absolute(a_h) + 1 p_h = kepler.semilatus_rectum(np.absolute(a_h), ecc_h) nu_h = 0 # hohmann transfer from hyperbolic orbit to circular orbit rb a_t, p_t, ecc_t = kepler.perapo2aecc(ra, rb) vt1 = maneuver.vel_mag(ra, a_t, mu) dva1, _, toft, phaset = maneuver.hohmann(ra, rb, ecc_h, 0, 0, 0, mu) # final orbit mean motion n2 = np.sqrt(mu / rb**3) angle = n2 * toft p2 = 2 * np.pi * np.sqrt(rb**3 / mu) phasing_period = p2 - toft # design of phasing orbit a_p = kepler.period2sma(phasing_period, mu) rc = a_p * 2 - rb a_p, p_p, ecc_p = kepler.perapo2aecc(rc, rb) # hohmann from transfer ellipse to phasing orbit vt2 = maneuver.vel_mag(rb, a_t, mu)
# orbit 1 properties a1, p1, ecc1 = kepler.perapo2aecc(ra, rb) va1 = maneuver.vel_mag(ra, a1, mu) vb1 = maneuver.vel_mag(rb, a1, mu) # orbit 2 properties a2, p2, ecc2 = kepler.perapo2aecc(rc, rd) vc2 = maneuver.vel_mag(rc, a2, mu) vd2 = maneuver.vel_mag(rd, a2, mu) # A to C Hohmann trasnfer at1, pt1, ecct1 = kepler.perapo2aecc(rc, ra) vat = maneuver.vel_mag(ra, at1, mu) vct = maneuver.vel_mag(rc, at1, mu) dv1, dv2, tof1, _ = maneuver.hohmann(ra, rc, ecc1, ecc2, 0, 0, mu) dvt1 = np.absolute(dv1) + np.absolute(dv2) print('A to C hohmann transfer') print('Semimajor axis : {} km'.format(at1)) print('Eccentricity : {} '.format(ecct1)) print('\nV1 at A : {} km/sec'.format(va1)) print('VT1 at A : {} km/sec'.format(vat)) print('DV1 : {} km/sec'.format(dv1)) print('\nV2 at C : {} km/sec'.format(vc2)) print('VT2 at C : {} km/sec'.format(vct)) print('DV2 : {} km/sec'.format(dv2)) print('TOF : {} sec'.format(tof1)) # B to D Hohmann trasnfer at2, pt2, ecct2 = kepler.perapo2aecc(rb, rd) vbt = maneuver.vel_mag(rb, at2, mu)
ecc_e = 0 ecc_n = 0 # circular earth velocity v_1 = np.sqrt(mu / a_e) v_2 = np.sqrt(mu / a_n) # transfer orbit a_t = .5 * (a_e + a_n) ecc_t = a_n / a_t - 1 p_t = kepler.semilatus_rectum(a_t, ecc_t) # velocity of transfer orbit at initial and final orbit sme_t = -mu / (2 * a_t) vt_1 = np.sqrt(2 * (sme_t + mu / a_e)) vt_2 = np.sqrt(2 * (sme_t + mu / a_n)) (dv_a, dv_b, tof, phase_angle) = maneuver.hohmann( a_e, a_n, ecc_e, ecc_n, 0, np.pi, mu) print('Initial Orbit Velocity : {} km/sec'.format(v_1)) print('Final Orbit Velocity : {} km/sec'.format(v_2)) print('Transfer SMA : {} km Eccentricity : {}'.format(a_t, ecc_t)) print('Transfer Periapsis velocity : {} km/sec'.format(vt_1)) print('Transfer Apoapsis velocity : {} km/sec'.format(vt_2)) print('Delta V1 : {} km/sec'.format(dv_a)) print('Delta V2 : {} km/sec'.format(dv_b)) print('TOF : {} sec = {} day = {} yr'.format(tof, tof/86400, tof/86400/365.25)) print('Phase : {} deg'.format(np.rad2deg(phase_angle))) # generate a plot of the orbit _, state_pqw1, _, _, sat_pqw1, _ = kepler.conic_orbit(a_e, 0, 0, 0, 0, 0, 0, mu) _, state_pqw2, _, _, sat_pqw2, _ = kepler.conic_orbit(a_n, 0, 0, 0, 0, np.pi, np.pi, mu)
"""Hohmann Transfer example Problem 5 HW 5 2017 """ from astro import constants, kepler, maneuver import numpy as np mu = constants.earth.mu # initial orbit r1 = 1.25 * constants.earth.radius r2 = 6.6 * constants.earth.radius at, pt, ecct = kepler.perapo2aecc(r1, r2) v1 = maneuver.vel_mag(r1, r1, mu) v2 = maneuver.vel_mag(r2, r2, mu) dv1, dv2, tof, phase_angle = maneuver.hohmann(r1, r2, 0, 0, 0, np.pi, mu) S = maneuver.synodic_period(r1, r2, mu) print('V1 : {} km/sec'.format(v1)) print('DV1 : {} km/sec'.format(dv1)) print('V2 : {} km/sec'.format(v2)) print('DV2 : {} km/sec'.format(dv2)) print('TOF : {} sec = {} hr'.format(tof, tof / 3600)) print('Phase Angle : {} deg'.format(np.rad2deg(phase_angle))) print('Synodic Period : {} sec = {} hr'.format(S, S / 3600))