inlined isp calc to make nde.ks standalone.
This commit is contained in:
parent
c8a839b49c
commit
4a1243fc95
4 changed files with 17 additions and 14 deletions
|
@ -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".
|
|
1
loadprograms.ks
Normal file
1
loadprograms.ks
Normal file
|
@ -0,0 +1 @@
|
||||||
|
compile "0:/nde.ks" to "1:/nde.ksm".
|
18
nde.ks
18
nde.ks
|
@ -1,5 +1,19 @@
|
||||||
//import functions
|
function evcalc { //returns the average exaust velocity of active engines. to convert to isp, divide by constant:g0
|
||||||
run once "lib/isp".
|
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.
|
set nd to nextnode.
|
||||||
|
|
||||||
//print out node's basic parameters - eta and deltav
|
//print out node's basic parameters - eta and deltav
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue