Advertisement
Guest User

Untitled

a guest
Jan 4th, 2018
1,709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. import os
  2. clear = lambda: os.system('cls')
  3.  
  4. import math
  5.  
  6. Gravity = 9.80665
  7.  
  8.  
  9. while True:
  10. clear()
  11.  
  12. DryMass = float(input("kg | Dry Mass: "))
  13. PayloadMass = float(input("kg | Payload Mass: "))
  14. print ""
  15.  
  16. FuelCapacity = float(input("kg | Fuel Capacity: "))
  17. print ""
  18.  
  19. Thrust = float(input("kN | Thrust: "))
  20. SpecificImpulse = input("s | Specific Impulse: ")
  21. print ""
  22.  
  23. exhaustVelocity = SpecificImpulse * Gravity
  24.  
  25. initialTotalMass = DryMass + PayloadMass + FuelCapacity
  26. finalTotalMass = DryMass + PayloadMass
  27. TsiolkovskyDeltaV = exhaustVelocity * math.log(initialTotalMass / finalTotalMass)
  28. print "Tsiolkovsky Rocket Equation Delta-v: " + str(TsiolkovskyDeltaV) + "m/s."
  29.  
  30. print ""
  31.  
  32. fuelPerSecond = Thrust * 1000 / exhaustVelocity
  33. print "Burning " + str(fuelPerSecond) + " kg of fuel per second."
  34. print "Burn Time: " + str(FuelCapacity / fuelPerSecond) + " seconds."
  35. fuel = FuelCapacity
  36.  
  37. totalDeltaV = 0
  38. while fuel >= fuelPerSecond:
  39. fuel -= fuelPerSecond
  40. totalMass = DryMass + PayloadMass + fuel
  41. totalDeltaV += Thrust * 1000 / totalMass
  42.  
  43. totalDeltaV += (Thrust * 1000 / (DryMass + PayloadMass)) * (fuel / fuelPerSecond)
  44.  
  45. print "Total Delta-v for specified vehicle: " + str(totalDeltaV) + "~m/s."
  46.  
  47. print raw_input("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement