inlined isp calc to make nde.ks standalone.
This commit is contained in:
parent
c8a839b49c
commit
fff3f847a6
4 changed files with 19 additions and 14 deletions
3
boot/loadprograms.ks
Normal file
3
boot/loadprograms.ks
Normal file
|
@ -0,0 +1,3 @@
|
|||
if not exists("1:/nde.ksm") {
|
||||
compile "0:/nde.ks" to "1:/nde.ksm".
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
function sascheck { //returns the average exaust velocity of active engines. to convert to isp, divide by constant:g0
|
||||
set saslist to ship:modulesnamed("ModuleSAS").
|
||||
if saslist:length = 0 {
|
||||
return false.
|
||||
}
|
||||
return true.
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
if not exists("1:/lib") {
|
||||
createdir("1:/lib").
|
||||
}
|
||||
compile "0:/lib/isp.ks" to "1:/lib/isp.ksm".
|
||||
compile "0:/nde.ks" to "1:/nde.ksm".
|
18
nde.ks
18
nde.ks
|
@ -1,5 +1,19 @@
|
|||
//import functions
|
||||
run once "lib/isp".
|
||||
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).
|
||||
}
|
||||
set nd to nextnode.
|
||||
|
||||
//print out node's basic parameters - eta and deltav
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue