View difference between Paste ID: P21mrvJN and 7086JimU
SHOW: | | - or go back to the newest paste.
1
2
//Rendezvous with space station from initial orbit of 210x400 km
3
clearscreen.
4
set pi to 3.1415926535897932384626433832795028841971693993751058209749445923.
5
set mu to 3.986*(10^14).
6
ag1 off.
7
rcs on.
8
sas off.
9
gear off.
10
set ship:control:neutralize to true.
11
lock steering to prograde + r(0,0,180).
12
set target to "LIESS".
13
print "Awaiting AG1".
14
wait until ag1.
15
ag1 off.
16
unlock steering.
17
sas on.
18
19
//I found that the initial orbit gains on the space station at 10 degrees
20
//per orbit.
21
set ang to 239485239.
22
Until ang < 15 {
23
  print "Please wait. Circularization will occur when".
24
  print "initial phasing is complete".
25
  set ang to vang(ship:body:position,(target:position+ship:body:position)).
26
  print "Loop ends at zero: "+round(100*(ang-15)).
27
  wait 0.1.
28
  clearscreen.
29
}
30
set warp to 0.
31
print "Circularizing at Apogee".
32
if ship:verticalspeed > 0 {
33
  wait until ship:verticalspeed<0.
34
} else {
35
  wait until ship:verticalspeed>0.
36
  wait until ship:verticalspeed<0.
37
}
38
39
//Circularizing
40
set kpv to 1. //to control the vertical speed to keep it at zero
41
sas off.
42
lock steering to prograde + r(0,0,180).
43
set ship:control:fore to 1. //burn
44
set shipA to 0.
45
set targetA to 29483924832.
46
set A0 to ship:altitude.
47
until ship:apoapsis>(A0+500) {
48
  print "Burning".
49
  wait 0.1.
50
  clearscreen.
51
  set ship:control:top to (kpv*ship:verticalspeed). //Controlling vertical speed
52
}
53
set ship:control:neutralize to true.
54
print "Circularized at "+round(.5*(ship:apoapsis+ship:periapsis))+" meters".
55
56
print "Awaiting AG1".
57
wait until ag1.
58
ag1 off.
59
unlock steering.
60
sas on.
61
62
//second phasing orbit. This one gains on the space station at about 2.5 degrees
63
//per orbit (400x400)
64
set ang to 100000.
65
Until ang < 2.5 {
66
  print "Please wait. Transfer will occur when".
67
  print "secondary phasing is complete".
68
  set ang to vang(ship:body:position,(target:position+ship:body:position)).
69
  print "Loop ends at zero: "+round(100*(ang-2.5)).
70
  wait 0.1.
71
  clearscreen.
72
}
73
74
print "Awaiting Station Apsis".
75
set warp to 0.
76
//the two spacecraft have a very low angular difference, so when the station is
77
//at an apsis, the spacecraft is approximately at that apsis. Burning at this
78
//point gives the chaser a similar argument of perigee
79
wait until abs(target:verticalspeed<0.1).
80
sas off.
81
lock steering to prograde + r(0,0,180).
82
print "Initiating Hohmann Transfer to 5km below Station Orbit".
83
set ship:control:fore to 1.
84
85
//stops burn when chaser apogee is at either target apogee or perigee
86
if abs(target:altitude-target:periapsis)<1000 {
87
  wait until ship:apoapsis>(target:apoapsis-4750).
88
} else {
89
  wait until ship:apoapsis>(target:periapsis-4750).
90
}
91
set ship:control:neutralize to true.
92
print "Transfer Burn Complete".
93
print "Awaiting AG1".
94
wait until ag1.
95
ag1 off.
96
unlock steering.
97
sas on.
98
clearscreen.
99
//stops at just below 5km
100
until (target:altitude-ship:altitude)<5075 {
101
  print "Awaiting Apogee".
102
  print "Loop ends at zero: "+round((target:altitude-ship:altitude)-5075).
103
  wait 0.1.
104
  clearscreen.
105
}
106
set warp to 0.
107
clearscreen.
108
print "Awaiting AG1".
109
wait until ag1.
110
ag1 off.
111
run fivekm.