Merge branch 'main' of ssh://git.annabunch.es:2222/annabunches/kOS into main
This commit is contained in:
commit
ff72ff31f1
|
@ -36,8 +36,11 @@ function BurnTime {
|
||||||
// Docs suggest DeltaV:DURATION is not entirely reliable, however.
|
// Docs suggest DeltaV:DURATION is not entirely reliable, however.
|
||||||
// For now we're logging both values for comparison.
|
// For now we're logging both values for comparison.
|
||||||
local t is burnTimeCalc(dVs, m, Isp, f).
|
local t is burnTimeCalc(dVs, m, Isp, f).
|
||||||
|
|
||||||
|
// debug
|
||||||
print "Computed stage burn time = " + t.
|
print "Computed stage burn time = " + t.
|
||||||
print "KSC-estimated stage burn time = " + SHIP:StageDeltaV(s):DURATION.
|
print "KSC-estimated stage burn time = " + SHIP:StageDeltaV(s):DURATION.
|
||||||
|
// end debug
|
||||||
|
|
||||||
local parts is list().
|
local parts is list().
|
||||||
for part in parts {
|
for part in parts {
|
||||||
|
@ -49,7 +52,12 @@ function BurnTime {
|
||||||
return t + BurnTime(dV - SHIP:STAGEDELTAV(s):VACUUM, m, s - 1).
|
return t + BurnTime(dV - SHIP:STAGEDELTAV(s):VACUUM, m, s - 1).
|
||||||
}
|
}
|
||||||
|
|
||||||
return burnTimeCalc(dV, m, Isp, f).
|
// debug
|
||||||
|
local t is burnTimeCalc(dV, m, Isp, f).
|
||||||
|
print "Burn time in last utilized stage = " + t.
|
||||||
|
// end debug
|
||||||
|
|
||||||
|
return t.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convenience function to wrap the actual calculation for burn time.
|
// Convenience function to wrap the actual calculation for burn time.
|
||||||
|
|
|
@ -25,16 +25,20 @@ print "dV = " + NEXTNODE:DELTAV:MAG.
|
||||||
|
|
||||||
// Execute the burn, throttling down by half every time we're
|
// Execute the burn, throttling down by half every time we're
|
||||||
// consuming more than 25% of our dV in one update.
|
// consuming more than 25% of our dV in one update.
|
||||||
until NEXTNODE:DELTAV:MAG <= 0.25 or dVMin < NEXTNODE:DELTAV:MAG {
|
local droppedOnce is false.
|
||||||
|
until NEXTNODE:DELTAV:MAG <= 0.25 or (dVMin < NEXTNODE:DELTAV:MAG and droppedOnce) {
|
||||||
// debug
|
// debug
|
||||||
print "dVMin = " + dvMin.
|
print "dVMin = " + dvMin.
|
||||||
print "dV = " + NEXTNODE:DELTAV:MAG.
|
print "dV = " + NEXTNODE:DELTAV:MAG.
|
||||||
|
|
||||||
if NEXTNODE:DELTAV:MAG < dVMin {
|
if NEXTNODE:DELTAV:MAG > dVMin {
|
||||||
|
set droppedOnce to true.
|
||||||
|
} else {
|
||||||
set dvMin to NEXTNODE:DELTAV:MAG.
|
set dvMin to NEXTNODE:DELTAV:MAG.
|
||||||
|
set droppedOnce to false.
|
||||||
}
|
}
|
||||||
|
|
||||||
wait 0.001.
|
wait 0.01.
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock THROTTLE.
|
unlock THROTTLE.
|
||||||
|
|
9
scratch/math.ks
Normal file
9
scratch/math.ks
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
@lazyglobal off.
|
||||||
|
|
||||||
|
function Bound {
|
||||||
|
parameter minB.
|
||||||
|
parameter maxB.
|
||||||
|
parameter value.
|
||||||
|
|
||||||
|
return min(max(value, minB), maxB).
|
||||||
|
}
|
15
scratch/misc.ks
Normal file
15
scratch/misc.ks
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// Check for various sensors and set appropriate global constants.
|
||||||
|
// Currently only checks for grav sensor, as that's the only one used by this library.
|
||||||
|
// global HAS_GRAV_SENSOR is false.
|
||||||
|
// function SensorCheck {
|
||||||
|
// local SensorList is 0.
|
||||||
|
// list SENSORS in SensorList.
|
||||||
|
// for s in SensorList {
|
||||||
|
// if s:type = "grav" {
|
||||||
|
// print "Gravometric sensor detected".
|
||||||
|
// set HAS_GRAV_SENSOR to true.
|
||||||
|
// return.
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// set HAS_GRAV_SENSOR to false.
|
||||||
|
// }
|
Loading…
Reference in New Issue
Block a user