Improvements and gui to ascent script
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// staging.ks
|
||||
// Utility functions related to staging and the effects of changing stages
|
||||
//
|
||||
// Usage:
|
||||
// basicStaging()
|
||||
// calcBurnTime(dvNeeded: scalar)
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
|
||||
function calcBurnTime {
|
||||
parameter dvNeeded.
|
||||
|
||||
local totalTime to 0.
|
||||
local dvRemaining to dvNeeded.
|
||||
local stageNum to ship:stagenum.
|
||||
|
||||
until dvRemaining <= 0 or stageNum < 0 {
|
||||
local stageDv to ship:stagedeltav(stageNum):current.
|
||||
local stageTime to ship:stagedeltav(stageNum):duration.
|
||||
|
||||
print "Stage: " + stageNum.
|
||||
if stageDv <= 0 {
|
||||
set stageNum to stageNum - 1.
|
||||
} else if stageDv >= dvRemaining {
|
||||
set totalTime to totalTime + stageTime * (dvRemaining / stageDv).
|
||||
set dvRemaining to 0.
|
||||
} else {
|
||||
set totalTime to totalTime + stageTime.
|
||||
set dvRemaining to dvRemaining - stageDv.
|
||||
set stageNum to stageNum - 1.
|
||||
}
|
||||
|
||||
print " - time: " + totalTime.
|
||||
print " - dv : " + dvRemaining.
|
||||
}
|
||||
|
||||
if dvRemaining > 0 {
|
||||
print "WARNING: Insufficient dV. Short by " + round(dvRemaining, 1) + " m/s.".
|
||||
}
|
||||
|
||||
return totalTime.
|
||||
}
|
||||
|
||||
function deployables {
|
||||
ag1 on.
|
||||
wait 0.5.
|
||||
panels on.
|
||||
radiators on.
|
||||
ag2 on.
|
||||
}
|
||||
Reference in New Issue
Block a user