Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accuracy of BurnTime(double dv) in Node Executor class #544

Closed
poteat opened this issue Feb 18, 2015 · 3 comments
Closed

Accuracy of BurnTime(double dv) in Node Executor class #544

poteat opened this issue Feb 18, 2015 · 3 comments

Comments

@poteat
Copy link

poteat commented Feb 18, 2015

The current code takes the average acceleration over stages to estimate how long the burn will be. This function is primarily used to estimate how long a burn will take, so the autopilot will begin the burn early. In-game I've often noticed how it does not display the accurate value until it begins burning, and is highly inaccurate sometimes.

This is because, mathematically, maximum acceleration increases over the time of a burn due to mass loss. You can analytically take this into account by integrating Thrust/Mass(t) with respect to time.

I derived the following formula using integration:
burn_time_formula

I think most of the variables are pretty obvious, but to clarify:
t_burn-> Time the craft must burn at the apoapsis to achieve circularization
Isp -> Vacuum Isp of the craft,
g -> 9.81, or not, depending upon your units of Isp
m_i -> mass at the beginning of the burn
T -> Maximum thrust
S -> Standard gravitational parameter of current planet
r -> Radius of apoapsis
e -> orbital eccentricity at beginning of burn
Important note: The 'e' in the base of the exponent is Euler's number 2.718, not eccentricity.

It does not take into account the mass lost during staging, so it still requires some logic around it. Implement it or not, I don't mind. I'm using it for my project (also for beginning burns early), and thought it may or may not prove useful to you. I understand that a small amount of accuracy is rarely worth complicated code.

Attached is a small Excel spreadsheet I was using to confirm it worked.

Burn_time_calculation.xlsx

@sarbian
Copy link
Contributor

sarbian commented Feb 18, 2015

Are you sure you looked at the right part of the code ? Because the current code does take the start and end mass of each stage into account.

@poteat
Copy link
Author

poteat commented Feb 18, 2015

Yes, the delta-v calculation is spot-on. It gets inaccurate (by about a second and a half) when you calculate average acceleration. You're assuming that because mass has a constant negative rate, and a = T/m, that you can calculate the average mass and just use that to find the average acceleration.

However, because mass is in the denominator, the average acceleration does not equal thrust divided by the average mass.

On further perusal of the code, I realized the above formula can be simplified down, since you are given the required dv already.

@lamont-granquist
Copy link
Collaborator

The current node executor code currently takes this into account, and there's cleanup in #1061 which should further help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants