HvrdlS

Starhopper Test Software V4/Static Fire/Preburner

Sep 23rd, 2021 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. clearscreen.
  2. on ag10 {
  3. aborttest().
  4. }
  5.  
  6. prep().
  7. fuel().
  8. preburner().
  9. detanking().
  10.  
  11.  
  12. function prep {
  13. print "Welcome to Starhopper Test Software V4!".
  14. wait 2.
  15. print "Running hardware, preparings for software...".
  16. wait 5.
  17. set teststatus to "Preparations".
  18. wait until teststatus = "Preparations".
  19. stage.
  20. wait 1.
  21. set goal to "Static fire".
  22. if goal = "Preburner" {
  23. set n to 95.
  24. } else if goal = "Static fire" {
  25. set n to 1.
  26. }
  27.  
  28. set northPole TO latlng(90,0).
  29. set head TO mod(360 - northPole:bearing,360).
  30. lock steering to heading(head,90).
  31. set lenght to 2.
  32. set maxthr to ship:maxthrust.
  33. set needthr to maxthr/n.
  34. lock diff to needthr - curthr.
  35. list engines in engList.
  36. set eng to engList[0].
  37. lock curthr to eng:thrust.
  38. if goal = "Preburner" {
  39. set tthr to 0.05.
  40. } else if goal = "Static fire" {
  41. set tthr to 1.
  42. }
  43.  
  44. print "Goal: " + goal.
  45. print "Lenght: " + lenght + " Seconds".
  46. print "Need throttle on test: " + needthr + "kn".
  47. print "Press 9".
  48. wait 1.
  49. wait until ag9.
  50. set now to time:seconds.
  51. lock testtime to time:seconds - now.
  52. wait 1.
  53. toggle ag9.
  54. set teststatus to "Fueling".
  55. print "Go for test".
  56. }
  57.  
  58. function fuel {
  59. wait until teststatus = "Fueling".
  60. print "Beginning fueling".
  61. wait 1.
  62. toggle ag3.
  63. wait 1.
  64. toggle ag2.
  65. wait 3.
  66. print "Awaiting for fueling end, press 9 to end".
  67. until ag9 {
  68. printing().
  69. }
  70.  
  71. set teststatus to goal + " preparing".
  72. wait 1.
  73. toggle ag3.
  74. toggle ag2.
  75. wait 1.
  76. toggle ag9.
  77. print "Fueling finished, press 9".
  78. wait 1.
  79. until ag9 {
  80. printing().
  81. }
  82.  
  83. set teststatus to goal + " go".
  84. }
  85.  
  86. function preburner {
  87. wait 1.
  88. lock throttle to 0.05.
  89. wait 1.
  90. set n to time:seconds.
  91. lock t to time:seconds - n.
  92. lock throttle to min(tthr, t/1).
  93. print "Test began".
  94. until t > lenght - 0.01 {
  95. clearscreen.
  96. print "Test lenght: " + t + " Seconds".
  97. print "Need throttle: " + needthr + "kn".
  98. print "Current throttle: " + curthr + "kn".
  99. print "Maximum throttle: " + maxthr + "kn".
  100. print "Difference: " + diff + "kn".
  101. log t + ";" + diff + ";" + maxthr + ";" to starhoppertest.txt.
  102. wait 0.1.
  103. }
  104.  
  105. lock throttle to 0.05.
  106. print "Test completed".
  107. wait 4.
  108. lock throttle to 0.
  109. set teststatus to "Completed".
  110. }
  111.  
  112. function detanking {
  113. wait until teststatus = "Completed".
  114. print "Test status: " + teststatus.
  115. ag2 on.
  116. ag3 on.
  117. wait 1.
  118. toggle ag9.
  119. print "Detanking".
  120. wait 100.
  121. }
  122.  
  123. function printing {
  124. clearscreen.
  125. print "Time from test beginning: " + testtime + " Seconds".
  126. print "Test status: " + teststatus.
  127. print "Goal: " + goal.
  128. print "Lenght of test: " + lenght + " Seconds".
  129. print "Time(KSC): " + time:clock.
  130. wait 0.1.
  131. }
  132.  
  133. function aborttest {
  134. print "Abort".
  135. lock throttle to 0.
  136. unlock steering.
  137. if ag3 or ag2 or ag1 {
  138. detanking().
  139. } else {
  140. print 3/0.
  141. }
  142. }
Add Comment
Please, Sign In to add comment