-
Notifications
You must be signed in to change notification settings - Fork 0
/
ballistic.ks
executable file
·32 lines (30 loc) · 1004 Bytes
/
ballistic.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
31
32
CLEARSCREEN.
PRINT "*** BALLISTIC BURN TEST ***" AT (0,0).
SET Cd TO 0.011.
SET TRAJECTORYANGLE TO 70.
SET Vo TO 100.
SET Uo TO 100.
SET TRAJECTORYANGLE TO (ARCTAN(Vo/Uo)).//* constant:RadToDeg.
PRINT "TRAJECTORYANGLE: " + TRAJECTORYANGLE.
SET Density TO 1.225.
lock g to constant:g * body:mass / body:radius^2. // Gravity (m/s^2)
SET Vt TO SQRT((2*SHIP:MASS*g)/(Cd*Density)).
SET FALLTIMEHMS TO (Vo/g)*2.
SET UoHMS TO Uo.
LOCK CALCHORV TO COS((ARCSIN(SHIP:VERTICALSPEED/SHIP:AIRSPEED)))*SHIP:AIRSPEED.
PRINT "EST FALLTIME: " + FALLTIMEHMS AT (0,1).
SET X TO ((Vt*Vt)/g)*(LN(((Vt*Vt)+g*UoHMS*FALLTIMEHMS)/(Vt*Vt))).
PRINT "Calculated X: " + X AT (0,3).
UNTIL CALCHORV > 100 {
LOCK THROTTLE TO 1.0.
LOCK STEERING TO HEADING(90,TRAJECTORYANGLE).
}
LOCK THROTTLE TO 0.0.
LOCK STEERING TO HEADING(90,90).
SET STARTINGALT TO ALT:RADAR.
SET STARTINGSPOT to SHIP:GEOPOSITION.
UNTIL (ALT:RADAR < STARTINGALT)
{
}
SET REALDISTANCE TO STARTINGSPOT:DISTANCE.
PRINT "REAL DISTANCE: " + REALDISTANCE AT (0,5).