forked from RCrockford/kOS-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.ks
More file actions
34 lines (24 loc) · 737 Bytes
/
test.ks
File metadata and controls
34 lines (24 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@lazyglobal off.
// Wait for unpack
wait until Ship:Unpacked.
local alleng is list().
list engines in alleng.
lock throttle to 0.
for eng in alleng
{
print eng:title + "[" + eng:Config + "] residuals: " + eng:residuals.
eng:Activate.
local wm is ship:mass.
local dm is wm.
local dmr is wm.
for k in eng:consumedResources:keys
{
local r is eng:ConsumedResources[k].
set dm to dm - r:Amount * r:Density.
set dmr to dmr - (r:Amount - r:capacity * eng:residuals) * r:Density.
}
print "Naive Δv: " + round(eng:IspAt(0) * Constant:g0 * ln(wm / dm), 1).
print "Residual Δv: " + round(eng:IspAt(0) * Constant:g0 * ln(wm / dmr), 1).
eng:shutdown.
}
unlock throttle.