Fuel flow simulation and staging controller improvements - #2302
Open
AntonKuzin wants to merge 4 commits into
Open
Fuel flow simulation and staging controller improvements#2302AntonKuzin wants to merge 4 commits into
AntonKuzin wants to merge 4 commits into
Conversation
AntonKuzin
commented
Aug 13, 2026
|
|
||
| if (r.amount <= p.resourceRequestRemainingThreshold) | ||
| continue; | ||
| return false; |
Author
There was a problem hiding this comment.
This is for crossfeeding boosters. Currently, it doesn't stage till both fuel and oxidizer are depleted. But it's not optimal - it should stage if one of them is empty
AntonKuzin
commented
Aug 13, 2026
| double maxTime = ResourceMaxTime(); | ||
|
|
||
| return maxTime < double.MaxValue && maxTime >= 0 ? maxTime : 0; | ||
| return maxTime < double.MaxValue && maxTime > 0.001 ? maxTime : 0.001; |
Author
There was a problem hiding this comment.
This should address the steps limiter issue. For cryogenic fuels the amount of fuel left per tank is slightly different, so it tries to calculate the fuel flow in 1e-6 steps.
AntonKuzin
commented
Aug 13, 2026
| // FIXME: if we have constructed a segment which is > 0 dV, but less than 0.02s, and there's a | ||
| // prior > 0dV segment in the same kspStage we should add those together to reduce clutter. | ||
| if (Abs(vessel.ThrustMagnitude - currentThrust) > 1e-12) | ||
| if (dt >= 0.02 && activeAngines != vessel.ActiveEngines.Count) |
Author
There was a problem hiding this comment.
This should address the phantom 0 dv 0 burn time phases constantly appearing and disappearing.
AntonKuzin
commented
Aug 14, 2026
| if (_amount < 0) | ||
| _amount = 0; | ||
| if (_amount < ResidualThreshold) | ||
| _amount = ResidualThreshold; |
Author
There was a problem hiding this comment.
As we may drain more fuel than we should, just don't allow it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See the comments for details