Advertisement
Guest User

Untitled

a guest
Oct 16th, 2013
829
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. clearscreen.
  2. sas off.
  3. set xBurn to 0.
  4. set sRetro to 0.
  5. set touchDown to 0.
  6. set loopTime to 0.
  7. set iFlag to 0.
  8. set tImpact to 99.
  9. set brakeTime to 0.
  10. set final to 0.
  11. set Fd to 0.
  12. set sBurn to 0.
  13. set vsx to 0.
  14. set vsy to 0.
  15. set vsz to 0.
  16. set TWR to maxthrust / (mass*9.81).
  17. set tTWR to 0.
  18. set hTerrain to 0.
  19. set inputFlag to 0.
  20. set bitMask to " ".
  21. print "Landing Sequence activated.".
  22. wait 1.
  23. toggle gear.
  24.  
  25. lock throttle to (tTWR * 9.81 * mass / maxthrust).
  26. lock steering to retrograde + R(0,0,-90).
  27.  
  28. print "Use Action Group 7 to begin Retro Burn.".
  29. print "Use Action Group 9 to Cancel.".
  30. until inputFlag = 1
  31. {
  32. if ag7 = "True" { set inputFlag to 1. toggle ag7. }.
  33. if ag9 = "True" { toggle ag9. print garbage. }.
  34. }.
  35.  
  36. clearscreen.
  37. print "Begin retro burn.".
  38. set tTWR to 2.
  39.  
  40. when periapsis < 20000 then
  41. {
  42. set tTWR to 0.
  43. set xBurn to 1.
  44. if altitude > 70000 { wait 1. set warp to 3. }.
  45. wait 1.
  46. }.
  47. wait until xBurn = 1.
  48.  
  49. when altitude < 36000 then lock steering to R(0,0,0) + V(vsx,vsy,vsz).
  50. when (altitude-hTerrain) < 1000 then set iFlag to 1.
  51. when brakeTime > tImpact AND verticalspeed < 0 then
  52. {
  53. set sBurn to 1.
  54. when surfacespeed < 3 then set tTWR to 2.
  55. when surfacespeed < .001 then lock steering to up.
  56. when verticalspeed > -10 then
  57. {
  58. set sBurn to 0.
  59. set tTWR to 0.
  60. toggle gear.
  61. set final to 1.
  62. }.
  63. }.
  64.  
  65. until touchDown = 1
  66. {
  67. set t1 to missiontime.
  68. set vs to velocity:surface.
  69. set vsx to 0 - vs:x.
  70. set vsy to 0 - vs:y.
  71. set vsz to 0 - vs:z.
  72. set TWR to maxthrust / (mass*9.81).
  73. set cTWR to (TWR * throttle).
  74. set negAltC to ((0-altitude)/5000).
  75. set atmP to (2.718^negAltC).
  76. set atmD to atmP * 1.2230948554874.
  77. set Fd to 0.5 * atmD * abs(verticalspeed)^2 * 0.2 * (mass*.008).
  78. set aTWR to TWR - (Fd/1000).
  79. if alt:radar < 0 { set hTerrain to 0. }.
  80. if alt:radar > 0 { set hTerrain to (altitude - alt:radar). }.
  81.  
  82. if iFlag = 1
  83. {
  84. print "Terrain height is " + hTerrain at (0,17).
  85. set tImpact to (altitude-hTerrain) / abs(verticalspeed).
  86. set brakeTime to abs(verticalspeed) / (TWR*9.81).
  87. }.
  88.  
  89. if sBurn = 1 { set tTWR to aTWR. }.
  90.  
  91. if final = 1
  92. {
  93. if status = "LANDED" OR status = "SPLASHED" { set touchDown to 1. }.
  94. if (altitude-hTerrain) > 30 { set deThrottle to -10. }.
  95. if (altitude-hTerrain) < 30 { set deThrottle to -2. }.
  96. if verticalspeed < deThrottle { set tTWR to 1.2. }.
  97. if verticalspeed > deThrottle { set tTWR to .95. }.
  98. }.
  99.  
  100. print "Impact in T-" + tImpact + bitMask at (0,5).
  101. print "Time to 0m/s " + brakeTime + bitMask at (0,7).
  102. print "Radar Alt " + (altitude-hTerrain) + bitMask at (0,9).
  103. print "Status " + status + bitMask at (0,11).
  104. print "Looptime " + loopTime + bitMask at (0,13).
  105. print "Force of Drag " + Fd + bitMask at (0,15).
  106. set t2 to missiontime.
  107. set loopTime to t2 - t1.
  108. }.
  109. sas on.
  110. print status.
  111. lock throttle to 0.
  112. wait 2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement