-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtrim.ks
More file actions
46 lines (38 loc) · 985 Bytes
/
Copy pathtrim.ks
File metadata and controls
46 lines (38 loc) · 985 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//This script is used to trim satallites
//without RCS into a stable user-specified orbit.
PARAMETER user_period.
FUNCTION trim {
PARAMETER orbper_new.
//Variables
SET orbper TO (OBT:PERIOD / 3600) - orbper_new.
SET orbper_old TO OBT:PERIOD / 3600.
SET vthrot TO 0.
SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0.
SAS OFF.
//Steer Craft in Correct Direction
IF orbper > 0 LOCK STEERING TO RETROGRADE.
IF orbper < 0 LOCK STEERING TO PROGRADE.
CLEARSCREEN.
PRINT "STABALIZING CRAFT".
PRINT " ".
WAIT 30.
//Trim the Orbit
PRINT "TRIMMING ORBIT".
PRINT " ".
WAIT 3.
UNTIL ABS(orbper) < 0.00001 {
LOCK orbper TO ABS((OBT:PERIOD / 3600) - orbper_new).
LOCK vthrot TO orbper * 2.
IF vthrot > 1 LOCK vthrot TO 1.
LOCK THROTTLE TO vthrot.
WAIT 0.001.
}
LOCK THROTTLE TO 0.
//Provide Output.
PRINT "ORBITAL PERIOD WAS " + ROUND(orbper_old , 6) + " HRS".
PRINT " ".
PRINT "ORBITAL PERIOD IS NOW " + ROUND((OBT:PERIOD / 3600) , 6) + " HRS".
PRINT " ".
}
trim(user_period).
//End of Script