Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //activate screen after apoapsis. should theoretically work with each rocket with mammoth engine.
- clearscreen.
- SAS OFF.
- RCS ON.
- //BRAKES ON.
- LOCK STEERING TO (-1) * SHIP:VELOCITY:SURFACE. //rocket pointing retrograde
- //declaring variables
- 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.
- SET LANDED TO FALSE.
- 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
- Set l to 1.29488/s. //weight lost per second in tonnes.
- SET dist to 0.0. //distance needed to slow rocket to <10m/s. value assigned later.
- //calculates when to fire engine
- UNTIL (ALT:RADAR - dist < 40) //when the rocket should be at: <10 m/s at 40m height, continue.
- {
- SET dist TO 0.0. //resets dist
- SET theoV TO SHIP:VELOCITY:SURFACE:MAG. //resets variable theoV -> theoretical velocity: the velocity the ship should have after x seconds of burning
- SET i to 0. //resets i. the (theoretical)amount of seconds burned
- SET m to SHIP:MASS. //sets variable m to current mass (wait, why did i declare this in here instead of outside the loop?)
- UNTIL (theoV<10) //Calculates the distance needed to slow down. to <10m/s
- {
- Set dist to dist+theoV/s. //adds the current theoretical velocity to the distance
- 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
- 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)
- }
- print "dist="+ dist. //prints distance needed to slow to <10m/s
- }
- print "ALT=" + ALT:RADAR. //prints current height above ground
- print"Mass=" + SHIP:MASS. //prints current mass
- print"starting time: "+ TIME:CLOCK. //prints time the burn started
- print ("throught"). //prints that the programm is throught the calculation
- LOCK THROTTLE TO 1. //starts slowing burn (primitive but should kind of work)
- WAIT UNTIL SHIP:VELOCITY:SURFACE:MAG < 10. //when the rocket reaches 10 m/s it should maintain this velocity until it reaches the ground
- print"ending time: " + TIME:CLOCK. //prints time the slow down burn ended
- print"Mass=" + SHIP:MASS. //prints mass after slow down burn
- UNTIL LANDED
- {
- LOCK STEERING TO UP. //rocket now faces straight up instead of retrograde
- 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
- //print t.
- lock throttle to t.
- GEAR ON.
- WHEN SHIP:STATUS="LANDED" THEN
- {
- SET LANDED TO TRUE.
- }
- }
- LOCK THROTTLE TO 0.
- WAIT UNTIL LANDED.
- print("An Explosion you can walk away from counts as success!").
- WAIT 10.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement