Advertisement
Guest User

Untitled

a guest
May 10th, 2018
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. //activate screen after apoapsis. should theoretically work with each rocket with mammoth engine.
  2. clearscreen.
  3.  
  4. SAS OFF.
  5. RCS ON.
  6. //BRAKES ON.
  7.  
  8. LOCK STEERING TO (-1) * SHIP:VELOCITY:SURFACE. //rocket pointing retrograde
  9.  
  10. //declaring variables
  11. SET s to 25. //accuracy -> 1: the script pretends the ship slows down exactly by its acceleration exactly on the next second. s: the script pretends the ship slows down exactly by its acceleration exactly on 1/s seconds.
  12. SET LANDED TO FALSE.
  13. SET f to 3746.032/s. //force of engine at sea level in kN. using this to avoid crashing in the ground. shouldn't make to much difference
  14. Set l to 1.29488/s. //weight lost per second in tonnes.
  15. SET dist to 0.0. //distance needed to slow rocket to <10m/s. value assigned later.
  16.  
  17.  
  18.  
  19. //calculates when to fire engine
  20. UNTIL (ALT:RADAR - dist < 40) //when the rocket should be at: <10 m/s at 40m height, continue.
  21. {
  22. SET dist TO 0.0. //resets dist
  23. SET theoV TO SHIP:VELOCITY:SURFACE:MAG. //resets variable theoV -> theoretical velocity: the velocity the ship should have after x seconds of burning
  24. SET i to 0. //resets i. the (theoretical)amount of seconds burned
  25. SET m to SHIP:MASS. //sets variable m to current mass (wait, why did i declare this in here instead of outside the loop?)
  26. UNTIL (theoV<10) //Calculates the distance needed to slow down. to <10m/s
  27. {
  28. Set dist to dist+theoV/s. //adds the current theoretical velocity to the distance
  29. Set theoV to theoV - ((f/(m-i*l))-9.81/s). //calculates how much the rocket would slow down after 1 second more of burning
  30. Set i to i+1. //adds one more second (while writing these comments i realised that i could just make a theoretical mass variable instead of counting this up but i 'll leave it like this for now)
  31. }
  32. print "dist="+ dist. //prints distance needed to slow to <10m/s
  33.  
  34. }
  35. print "ALT=" + ALT:RADAR. //prints current height above ground
  36. print"Mass=" + SHIP:MASS. //prints current mass
  37. print"starting time: "+ TIME:CLOCK. //prints time the burn started
  38. print ("throught"). //prints that the programm is throught the calculation
  39. LOCK THROTTLE TO 1. //starts slowing burn (primitive but should kind of work)
  40.  
  41. WAIT UNTIL SHIP:VELOCITY:SURFACE:MAG < 10. //when the rocket reaches 10 m/s it should maintain this velocity until it reaches the ground
  42. print"ending time: " + TIME:CLOCK. //prints time the slow down burn ended
  43. print"Mass=" + SHIP:MASS. //prints mass after slow down burn
  44. UNTIL LANDED
  45. {
  46. LOCK STEERING TO UP. //rocket now faces straight up instead of retrograde
  47. Set t to (1*((9.7*SHIP:MASS)/SHIP:MAXTHRUST)). // these 3 lines should keep the rockets velocity at 10m/s. doesnt work to well but isn't the main problem and easier to fix
  48. //print t.
  49. lock throttle to t.
  50.  
  51. GEAR ON.
  52. WHEN SHIP:STATUS="LANDED" THEN
  53. {
  54. SET LANDED TO TRUE.
  55. }
  56.  
  57. }
  58. LOCK THROTTLE TO 0.
  59.  
  60.  
  61.  
  62.  
  63. WAIT UNTIL LANDED.
  64. print("An Explosion you can walk away from counts as success!").
  65. WAIT 10.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement