Skip to content

Commit 5717738

Browse files
Add files via upload
1 parent df91ee6 commit 5717738

2 files changed

Lines changed: 89 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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()
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import numpy as np
2+
import matplotlib.pyplot as plt
3+
4+
# ========== Constants ==========
5+
mu = 3.986e14 # gravitational constant × Earth’s mass
6+
R_earth = 6371e3 # Earth's radius (m)
7+
8+
# ========== Orbit altitudes (from 200 km to 36,000 km) ==========
9+
h = np.linspace(200e3, 36000e3, 200)
10+
r = R_earth + h
11+
12+
# ========== Orbital velocity at that altitude ==========
13+
v_orbit = np.sqrt(mu / r)
14+
15+
# ========== Approximate Δv to reach that orbit from Earth ==========
16+
v_surface = np.sqrt(mu / R_earth)
17+
print(v_surface)
18+
delta_v = v_orbit - v_surface # not realistic, but only for comparison
19+
delta_v = np.abs(delta_v)
20+
21+
# ========== Plot ==========
22+
plt.figure(figsize=(8, 5))
23+
plt.plot(h/1000, delta_v/1000, color='royalblue', linewidth=2)
24+
plt.title("Δv vs Orbit Altitude", fontsize=14)
25+
plt.xlabel("Orbit altitude (km)")
26+
plt.ylabel("Δv (km/s)")
27+
plt.grid(True)
28+
plt.show()

0 commit comments

Comments
 (0)