Skip to content

Instantly share code, notes, and snippets.

@xeger
Created June 8, 2015 07:04
Show Gist options
  • Save xeger/a6263b6854fa77848688 to your computer and use it in GitHub Desktop.
Save xeger/a6263b6854fa77848688 to your computer and use it in GitHub Desktop.
Tsiolkovsky burn equation
Derived from http://wiki.kerbalspaceprogram.com/wiki/Tutorial:Advanced_Rocket_Design#Delta-V
Basic idea: compute vessel Isp; mass-flow rate of engines; total mass burn;
derive burn duration using Tsiolkovsky formula.
Implemented, but it doesn't work; it gives bogus duration. Need to debug...
list engines in engs.
local thrustSum is 0.0.
local denomSum is 0.0.
FOR eng IN engs
{
local thrust is eng:maxthrust * eng:thrustlimit.
set thrustSum to thrustSum + thrust.
set denomSum to denomSum + (thrust / (eng:isp * 9.82)).
}.
local Isp is thrustSum / denomSum.
local massBurn is ((ship:mass * 1000) / constant():e ^ (nd:deltav:mag / Isp)).
local tsiol is ((ship:mass* 1000) - massBurn) / (thrustSum / Isp).
@zatricky
Copy link

Reddit brought me here. If you're still looking into this, check maneuverburnTime() at https://gist.github.com/gisikw/b8d1bd6e5a4ab4bbd81bb59ec7c15d48
Written in relation to a YouTube series he created:
https://www.youtube.com/watch?v=1yS3BUxQ-VQ&list=PLb6UbFXBdbCoCm1e65qfDOCdK_qIBtX3D

Happy kerbaling!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment