1+ import math
2+ import matplotlib .pyplot as plt
3+ import numpy as np
4+
5+ # ========== Constants ==========
6+ mu_earth = 3.986e14 # gravitational constant × Earth’s mass
7+ r_earth = 6371e3 # Earth radius (m)
8+
9+ # ========== Example orbits ==========
10+ r1 = r_earth + 200e3 # Low Earth Orbit (200 km)
11+ r2 = r_earth + 35786e3 # Geostationary Orbit (35,786 km)
12+
13+ def hohmann_delta_v (r1 , r2 , mu = mu_earth ):
14+ # ========== Hohmann transfer Δv (two burns) ==========
15+ v1 = math .sqrt (mu / r1 )
16+ v2 = math .sqrt (mu / r2 )
17+ a_transfer = (r1 + r2 ) / 2
18+
19+ v_perigee = math .sqrt (mu * (2 / r1 - 1 / a_transfer ))
20+ v_apogee = math .sqrt (mu * (2 / r2 - 1 / a_transfer ))
21+
22+ delta_v1 = abs (v_perigee - v1 )
23+ delta_v2 = abs (v2 - v_apogee )
24+ return delta_v1 , delta_v2 , delta_v1 + delta_v2
25+
26+ dv1 , dv2 , total = hohmann_delta_v (r1 , r2 )
27+ print (f"Δv1 = { dv1 / 1000 :.2f} km/s" )
28+ print (f"Δv2 = { dv2 / 1000 :.2f} km/s" )
29+ print (f"Gesamtes Δv = { total / 1000 :.2f} km/s" )
30+
31+ def rocket_equation (delta_v , Isp = 320 , m0 = 1000 ):
32+ g0 = 9.80665
33+ mf = m0 * math .exp (- delta_v / (Isp * g0 ))
34+ fuel_used = m0 - mf
35+ return fuel_used , (fuel_used / m0 ) * 100
36+
37+ fuel , percent = rocket_equation (total )
38+ print (f"Verbrauchtes Treibstoff: { fuel :.2f} kg ({ percent :.1f} % von Gesamtmasse)" )
39+
40+
41+ isp_values = np .linspace (200 , 450 , 100 )
42+
43+
44+ fuel_list = []
45+ for i in isp_values :
46+ f , _ = rocket_equation (total , Isp = i )
47+ fuel_list .append (f )
48+
49+
50+ plt .figure (figsize = (8 , 4 ))
51+ plt .plot (isp_values , fuel_list , color = 'blue' , linewidth = 2 )
52+ plt .title (f'Treibstoff für LEO -> GEO Transfer ({ int (total )} m/s)' )
53+ plt .xlabel ('Spezifischer Impuls (s)' )
54+ plt .ylabel ('Treibstoffmasse (kg)' )
55+ plt .grid (True , linestyle = '--' , alpha = 0.6 )
56+
57+
58+ plt .scatter ([320 ], [fuel ], color = 'red' , zorder = 5 )
59+ plt .text (330 , fuel , f'Mein Satellit\n (Isp=320s, Treibstoff={ int (fuel )} kg)' , color = 'red' )
60+
61+ plt .show ()
0 commit comments