Add code for automating satellite deployment.
This commit is contained in:
@ -17,12 +17,32 @@ function GetAscentVector {
|
||||
return newHeading.
|
||||
}
|
||||
|
||||
// Create a node that will circularize the orbit.
|
||||
// 'where' can be one of:
|
||||
// the special string "APO", for the next Apoapsis.
|
||||
// the special string "PERI", for the next Periapsis.
|
||||
// a time value (either a Time struct or a scalar), representing a target time.
|
||||
function CreateCircularizationNode {
|
||||
parameter nodeAtPeriapsis is false.
|
||||
parameter where is "APO".
|
||||
|
||||
local dt is choose SHIP:ORBIT:ETA:PERIAPSIS if nodeAtPeriapsis else SHIP:ORBIT:ETA:APOAPSIS.
|
||||
local a is choose SHIP:ORBIT:PERIAPSIS if nodeAtPeriapsis else SHIP:ORBIT:APOAPSIS.
|
||||
local t is TIME + dt.
|
||||
local dt is 0.
|
||||
local a is 0.
|
||||
local t is 0.
|
||||
if where:IsType("String") {
|
||||
if where = "APO" {
|
||||
set dt to SHIP:ORBIT:ETA:APOAPSIS.
|
||||
set a to SHIP:ORBIT:APOAPSIS.
|
||||
} else if where = "PERI" {
|
||||
set dt to SHIP:ORBIT:ETA:PERIAPSIS.
|
||||
set a to SHIP:ORBIT:PERIAPSIS.
|
||||
} else {
|
||||
print "WARNING: Invalid string passed to CreateCirculazationNode(). Node is invalid.".
|
||||
}
|
||||
|
||||
set t to TIME + dt.
|
||||
} else {
|
||||
set t to where.
|
||||
}
|
||||
|
||||
local Vc is sqrt(SHIP:BODY:MU/(SHIP:BODY:RADIUS + a)).
|
||||
local dV is Vc - VelocityAt(SHIP, t):ORBIT:MAG.
|
||||
|
Reference in New Issue
Block a user