KosScripts/lib/isp.ks

17 lines
519 B
Plaintext
Raw Normal View History

2024-07-06 11:35:41 -05:00
function evcalc { //returns the average exaust velocity of active engines. to convert to isp, divide by constant:g0
local englist is list().
local totalflow is 0.
local totalthrust is 0.
list engines in englist.
for eng in englist {
if eng:ignition and not eng:flameout {
set totalflow to totalflow + (eng:possiblethrust /(eng:isp * constant:g0)).
set totalthrust to totalthrust + eng:possiblethrust.
}
}
if totalthrust = 0 { //avoid div by 0 later
return 1.
}
return (totalthrust / totalflow).
}