Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # code for safe landing
- # http://www.codeabbey.com/index/task_view/safe-landing
- [spaceship_m, fuel_m, h0, v0] = [6000, 7000, 150000, 2000]
- #[spaceship_m, fuel_m, h0, v0] = [6000 7000 150000 2000]
- H = h0 /1000; V = v0 / 1000; g0 = 1.622; dt = 0.01; Vexhaust = 2800
- R = 1737.1 ;
- fuel_speed = [0, 100, 100, 100, 50, 50, 50, 50, 50, 50, 100, 100, 100]
- count = 0
- while (H > 0):
- H -= V*dt
- if count % 1000 == 0:
- i = count // 1000
- if i < len(fuel_speed) and fuel_m > 0:
- Mexaust = fuel_speed[i]
- dM = Mexaust * dt / 10
- else:
- Mexaust = 0
- fuel_m -= dM
- # каждые 10 секунд менять Mexaust, взяв его из списка
- # если топливо кончилось или нет больше элементов в списке
- # Mexaust = 0
- g_current = g0 * R**2 / (R+H)**2
- #print (g_current)
- V = V + g_current*dt / 1000
- #V -= Vexhaust * dM / (fuel_m + spaceship_m)
- count += 1
- print (V, H, count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement