Improve estimated burn duration equation readability.

This commit is contained in:
Casper V. Kristensen 2019-06-20 00:11:22 +02:00
parent 5f4df3b138
commit 5fd4bfc3d7
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -10,17 +10,20 @@ function estimated_burn_duration {
// Based on: // Based on:
// https://en.wikipedia.org/wiki/Tsiolkovsky_rocket_equation // https://en.wikipedia.org/wiki/Tsiolkovsky_rocket_equation
// https://space.stackexchange.com/questions/27375/how-do-i-calculate-a-rockets-burn-time-from-required-velocity // https://space.stackexchange.com/questions/27375/how-do-i-calculate-a-rockets-burn-time-from-required-velocity
// https://www.alternatewars.com/BBOW/Space/Rocket_Equations.htm
// //
parameter burn. parameter burn.
parameter isp is isp_sum(). parameter isp is isp_sum().
parameter maxthrust is SHIP:maxthrust. parameter thrust is SHIP:availablethrust.
if burn:istype("Node") { if burn:istype("Node") {
set burn to burn:deltav. set burn to burn:deltav.
} }
local exhaust_velocity is isp * (CONSTANT:G * KERBIN:mass). local deltav is burn:mag.
return ((SHIP:mass * exhaust_velocity) / maxthrust) * (1 - CONSTANT:E^(-burn:mag/exhaust_velocity)). local exhaust_velocity is isp * CONSTANT:g0.
local wet_mass is SHIP:mass.
return ((wet_mass * exhaust_velocity) / thrust) * (1 - CONSTANT:E^(-deltav/exhaust_velocity)).
} }