예제 #1
0
 def test_vallado61(self):
     alt_i = 191.34411  # km
     alt_f = 35781.34857  # km
     k = k_earth.to(units.km ** 3 / units.s ** 2).value
     R = R_earth.to(units.km).value
     expected_dv = 3.935224  # km/s
     expected_t_trans = 5.256713  # h
     r_i = R + alt_i
     r_f = R + alt_f
     dva, dvb, _, t_trans = hohmann(k, r_i, r_f)
     dv = abs(dva) + abs(dvb)
     assert_almost_equal(dv, expected_dv, decimal=2)
     assert_almost_equal(t_trans / 3600, expected_t_trans, decimal=2)
예제 #2
0
from poliastro.constants import k_Earth

ZOOM = True

v_i = 7.905  # km/s, immaterial

R = np.linspace(2, 75, num=1000)
Rstar = [15.58, 40, 60, 100, 200, np.inf]

hohmann_data = np.zeros_like(R)
bielliptic_data = np.zeros((len(R), len(Rstar)))

r_i = k_Earth / v_i ** 2
for ii, r in enumerate(R):
    r_f = r * r_i
    dva, dvb, _, _ = twobody.hohmann(k_Earth, r_i, r_f)
    hohmann_data[ii] = (abs(dva) + abs(dvb)) / v_i
    for jj, rstar in enumerate(Rstar):
        r_b = rstar * r_i
        dva, dvb, dvc, *_ = twobody.bielliptic(k_Earth, r_i, r_b, r_f)
        bielliptic_data[ii, jj] = (abs(dva) + abs(dvb) + abs(dvc)) / v_i

idx_max = np.argmax(hohmann_data)
hohmann_max = hohmann_data[idx_max]

ylims = (0.35, 0.6)

fig, ax = plt.subplots()

l, = ax.plot(R, hohmann_data, lw=2)
for jj in range(len(Rstar)):