-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircAtAP.ks
30 lines (23 loc) · 1.02 KB
/
CircAtAP.ks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// CircAtAP.ks - Create node to circularize at AP script
// Copyright © 2021 V. Quetschke
// Version 0.2, 09/19/2021
@LAZYGLOBAL OFF.
CLEARSCREEN.
//display info
PRINT "Calculate maneuver node".
PRINT "Apoapsis: "+round(apoapsis)+" m".
PRINT "Periapsis: "+round(periapsis)+" m".
PRINT "Time to apoapsis: "+round(eta:apoapsis)+"s".
PRINT "Running: CircAtAp".
PRINT " ".
LOCAL TargetV to ((body:mu)/(body:radius+apoapsis))^0.5. // Orbital speed at target altitude (apoapsis)
LOCAL ApoapsisV to (body:mu*((2/(body:radius+apoapsis))-(1/orbit:semimajoraxis)))^0.5. // Actual speed at AP
LOCAL BurnDeltaV to TargetV-ApoapsisV. // How much faster do we need to go to acive a cirular orbit
// Crude burn duration estimate
LOCAL burnDuration to (BurnDeltaV*mass)/availablethrust.
// Add the node
LOCAL myNode to NODE( TIME:SECONDS+eta:apoapsis, 0, 0, BurnDeltaV ).
ADD myNode.
PRINT "Start circularization burn in approx. "+round(eta:apoapsis-burnDuration/2)+" s".
WAIT 0.05.
SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0.