Advertisement
RA2lover

bi-elliptic transfer calculator

Sep 7th, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.67 KB | None | 0 0
  1. --------------INPUT PARAMETERS--------------------------------------
  2. GM = 3.5316e12 --body's standard gravitational parameter
  3. startalt= 100000 --burn's start altitude
  4. endalt = 2875000--butn's end altitude
  5. elliptictransferalt=8400000 --bi-elliptic transfer burn apoapsis
  6. -------------CODE FROM BELOW ON-------------------------------------
  7.  
  8. hohmannSMA = (startalt+endalt)/2
  9. ellipticstartSMA = (startalt+elliptictransferalt)/2
  10. ellipticendSMA=(endalt+elliptictransferalt)/2
  11.  
  12. startvel=math.sqrt(GM*((2/startalt)-(1/startalt)))
  13. hohmannvelpe=math.sqrt(GM*((2/startalt)-(1/hohmannSMA)))
  14. hohmannvelap=math.sqrt(GM*((2/endalt)-(1/hohmannSMA)))
  15. endvel=math.sqrt(GM*((2/endalt)-(1/endalt)))
  16.  
  17. --print(startvel, hohmannvelpe, hohmannvelap, endvel)
  18. print("Hohmann transfer burns:",hohmannvelpe-startvel, endvel-hohmannvelap)
  19. hohmanntotaldv= (hohmannvelpe-startvel)+(endvel-hohmannvelap)
  20. print("Total delta-v for Hohmann transfer:",hohmanntotaldv)
  21.  
  22.  
  23. ellipticvelstartpe=math.sqrt(GM*((2/startalt)-(1/ellipticstartSMA)))
  24. ellipticvelstartap=math.sqrt(GM*((2/elliptictransferalt)-(1/ellipticstartSMA)))
  25. ellipticvelendap=math.sqrt(GM*((2/elliptictransferalt)-(1/ellipticendSMA)))
  26. ellipticvelendpe=math.sqrt(GM*((2/endalt)-(1/ellipticendSMA)))
  27.  
  28. print("Bi-elliptic transfer burns:", ellipticvelstartpe-startvel, ellipticvelendap-ellipticvelstartap, ellipticvelendpe-endvel)
  29. bielliptictotaldv=(ellipticvelstartpe-startvel)+ (ellipticvelendap-ellipticvelstartap)+(ellipticvelendpe-endvel)
  30. print("Total delta-v for bi-elliptic transfer:",bielliptictotaldv)
  31.  
  32. print("Bi-elliptic transfer requires "..bielliptictotaldv/hohmanntotaldv.."x delta-v compared to a Hohmann transfer with given input parameters.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement