Fix satdeploy.

This commit is contained in:
Anna Rose Wiggins 2021-08-08 20:47:14 -04:00
parent 1860572067
commit 324d9ab7a3
5 changed files with 28 additions and 30 deletions

View file

@ -25,26 +25,21 @@ function GetAscentVector {
function CreateCircularizationNode {
parameter where is "APO".
local dt is 0.
local a is 0.
local t is 0.
local t is TIME.
if where:IsType("String") {
if where = "APO" {
set dt to SHIP:ORBIT:ETA:APOAPSIS.
set a to SHIP:ORBIT:APOAPSIS.
set t to TIME + SHIP:ORBIT:ETA:APOAPSIS.
} else if where = "PERI" {
set dt to SHIP:ORBIT:ETA:PERIAPSIS.
set a to SHIP:ORBIT:PERIAPSIS.
set t to TIME + SHIP:ORBIT:ETA:PERIAPSIS.
} else {
print "WARNING: Invalid string passed to CreateCirculazationNode(). Node is invalid.".
}
set t to TIME + dt.
} else {
// we've been passed a time at which to circularize.
set t to where.
}
local Vc is sqrt(SHIP:BODY:MU/(SHIP:BODY:RADIUS + a)).
local Vc is sqrt(SHIP:BODY:MU/(PositionAt(SHIP, t) - SHIP:BODY:POSITION):MAG).
local dV is Vc - VelocityAt(SHIP, t):ORBIT:MAG.
local n is Node(t, 0, 0, dV).