Stage during ascent, if needed.

This commit is contained in:
Anna Rose 2021-08-06 01:36:26 -04:00
parent 9b0792b81a
commit 75a7dfec22
2 changed files with 12 additions and 2 deletions

View File

@ -21,6 +21,16 @@ function Launch {
wait 0.5. wait 0.5.
} }
// staging logic. Stage as many times as needed until we finish ascent.
// Once Apo target is attained just drop this trigger.
when FlameOut() or SHIP:ORBIT:APOAPSIS > APOAPSIS_TARGET then {
if SHIP:ORBIT:APOAPSIS > APOAPSIS_TARGET {
return false.
}
stage.
return true.
}
// Hold throttle to maintain 1.5 TWR. // Hold throttle to maintain 1.5 TWR.
// We do *not* use a PID Loop here because we can // We do *not* use a PID Loop here because we can
// calculate the correct value discretely. // calculate the correct value discretely.

View File

@ -13,7 +13,7 @@ function ExecNode {
if WillStage(NEXTNODE:DELTAV:MAG) { if WillStage(NEXTNODE:DELTAV:MAG) {
print "WARNING: kOS will stage during this node execution. Safe cancellation requires reboot.". print "WARNING: kOS will stage during this node execution. Safe cancellation requires reboot.".
when flameOut() then { when FlameOut() then {
print "Flameout detected. Staging.". print "Flameout detected. Staging.".
stage. stage.
} }
@ -156,7 +156,7 @@ function stageMass {
return m. return m.
} }
function flameOut { function FlameOut {
local ens is List(). local ens is List().
list engines in ens. list engines in ens.
for en in ens { for en in ens {