// Functions for calculating values related to throttle and thrust. // point gravity for TWR calculations. local G is 0. lock G to SHIP:BODY:MU / ((SHIP:BODY:RADIUS+SHIP:ALTITUDE)^2). // Returns the throttle value you should use to achieve the // target TWR. If TWR can't be achieved, returns 1.0. (full throttle) function ThrottleToTWR { parameter targetTWR is 1.5. local m is SHIP:MASS. return min((targetTWR*m*G)/SHIP:AVAILABLETHRUST, 1.0). } // Calculates the ship's current TWR. function TWR { local m is ship:mass. local t is THROTTLE * SHIP:AVAILABLETHRUST. return t/(m*G). }