<jupyter_start><jupyter_text>New Horizons launch and trajectoryMain data source: <NAME> "New Horizons Mission Design" http://www.boulder.swri.edu/pkb/ssr/ssr-mission-design.pdf<jupyter_code>from astropy import time
from astropy import units as u

from poliastro.bodies import Sun, Earth, Jupiter
from poliastro.twobody import Orbit
from poliastro.plotting import StaticOrbitPlotter
from poliastro import iod
from poliastro.util import norm<jupyter_output><empty_output><jupyter_text>Parking orbitQuoting from "New Horizons Mission Design":> It was first inserted into an elliptical Earth parking orbitof **perigee altitude 165 km** and **apogee altitude 215 km**. [Emphasis mine]<jupyter_code>r_p = Earth.R + 165 * u.km
r_a = Earth.R + 215 * u.km

a_parking = (r_p + r_a) / 2
ecc_parking = 1 - r_p / a_parking

parking = Orbit.from_classical(
    Earth,
    a_parking,
    ecc_parking,
    0 * u.deg,
    0 * u.deg,
    0 * u.deg,
    0 * u.deg,  # We don't mind
    time.Time("2006-01-19", scale="utc"),
)

print(parking.v)
parking.plot();<jupyter_output>[0.         7.81989358 0.        ] km / s<jupyter_text>Hyperbolic exitHyperbolic excess velocity:$$ v_{\infty}^2 = \frac{\mu}{-a} = 2 \varepsilon = C_3 $$Relation between orbital velocity $v$, local escape velocity $v_e$ and hyperbolic excess velocity $v_{\infty}$:$$ v^2 = v_e^2 + v_{\infty}^2 $$ Option a): Insert $C_3$ from report, check $v_e$ at parking perigee<jupyter_code>C_3_A = 157.6561 * u.km ** 2 / u.s ** 2  # Designed

a_exit = -(Earth.k / C_3_A).to(u.km)
ecc_exit = 1 - r_p / a_exit

exit = Orbit.from_classical(
    Earth,
    a_exit,
    ecc_exit,
    0 * u.deg,
    0 * u.deg,
    0 * u.deg,
    0 * u.deg,  # We don't mind
    time.Time("2006-01-19", scale="utc"),
)

norm(exit.v).to(u.km / u.s)<jupyter_output><empty_output><jupyter_text>Quoting "New Horizons Mission Design":> After a short coast in the parking orbit, the spacecraft was then injected intothe desired heliocentric orbit by the Centaur second stage and Star 48B thirdstage. At the Star 48B burnout, the New Horizons spacecraft reached the highestEarth departure speed, **estimated at 16.2 km/s**, becoming the fastest spacecraftever launched from Earth.  [Emphasis mine]<jupyter_code>v_estimated = 16.2 * u.km / u.s

print(
    "Relative error of {:.2f} %".format(
        (norm(exit.v) - v_estimated) / v_estimated * 100
    )
)<jupyter_output>Relative error of 3.20 %<jupyter_text>So it stays within the same order of magnitude. Which is reasonable, because real life burns are not instantaneous.<jupyter_code>import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(8, 8))
op = StaticOrbitPlotter(ax=ax)

op.plot(parking)
op.plot(exit)

ax.set_xlim(-8000, 8000)
ax.set_ylim(-20000, 20000);<jupyter_output><empty_output><jupyter_text>Option b): Compute $v_{\infty}$ using the Jupyter flybyAccording to Wikipedia, the closest approach occurred at 05:43:40 UTC. We can use this data to compute the solution of the Lambert problem between the Earth and Jupiter.<jupyter_code>nh_date = time.Time("2006-01-19 19:00", scale="utc")
nh_flyby_date = time.Time("2007-02-28 05:43:40", scale="utc")
nh_tof = nh_flyby_date - nh_date

nh_earth = Orbit.from_body_ephem(Earth, nh_date)
nh_r_0, v_earth = nh_earth.rv()

nh_jup = Orbit.from_body_ephem(Jupiter, nh_flyby_date)
nh_r_f, v_jup = nh_jup.rv()

(nh_v_0, nh_v_f), = iod.lambert(Sun.k, nh_r_0, nh_r_f, nh_tof)<jupyter_output>/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/twobody/orbit.py:395: TimeScaleWarning:

Input time was converted to scale='tdb' with value 2006-01-19 19:01:05.184. Use Time(..., scale='tdb') instead.

/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/twobody/orbit.py:395: TimeScaleWarning:

Input time was converted to scale='tdb' with value 2007-02-28 05:44:45.185. Use Time(..., scale='tdb') instead.<jupyter_text>The hyperbolic excess velocity is measured with respect to the Earth:<jupyter_code>C_3_lambert = (norm(nh_v_0 - v_earth)).to(u.km / u.s) ** 2
C_3_lambert
print("Relative error of {:.2f} %".format((C_3_lambert - C_3_A) / C_3_A * 100))<jupyter_output>Relative error of 0.51 %<jupyter_text>Which again, stays within the same order of magnitude of the figure given to the Guo & Farquhar report.  From Earth to Jupiter<jupyter_code>nh = Orbit.from_vectors(Sun, nh_r_0.to(u.km), nh_v_0.to(u.km / u.s), nh_date)

op = StaticOrbitPlotter()

op.plot(nh_jup, label=Jupiter)
op.plot(nh_earth, label=Earth)
op.plot(nh, label="New Horizons");<jupyter_output>/home/juanlu/Development/poliastro/poliastro-library/src/poliastro/twobody/orbit.py:1090: UserWarning:

Frame <class 'astropy.coordinates.builtin_frames.icrs.ICRS'> does not support 'obstime', time values were not returned
{'fraction_non_alphanumeric': 0.12515829463908823, 'fraction_numerical': 0.04221190375685943, 'mean_word_length': 4.695913461538462, 'pattern_counts': {'":': 2, '<': 30, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '45911', 'license': 'MIT', 'n_tokens_mistral': 1983, 'n_tokens_neox': 1771, 'n_words': 455, 'path': 'docs/source/examples/Exploring the New Horizons launch.ipynb', 'repo_name': 'WolfsSky/poliastro', 'size': '4746'}