Skip to content

Update thrust calculation to include StartUT - #14

Merged
Phantomical merged 2 commits into
Phantomical:mainfrom
Jaheay:patch-1
Jul 8, 2026
Merged

Phantomical merged 2 commits into
Phantomical:mainfrom
Jaheay:patch-1

Conversation

@Jaheay

@Jaheay Jaheay commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Fixes an inconsistency in ThrustParameters.GetUTAtDeltaV() when vessel mass change is effectively zero.

GetUTAtDeltaV() is used as an absolute UT estimate. The normal mass-flow branch returns StartUT + duration, but the near-zero-mass-flow branch returned only duration:

return dv * StartMass / thrust;

That causes callers such as maneuver-node thrust integration to compute:

remainingT = Math.Max(estimateUT - parameters.StartUT, 0.0);

as zero once StartUT is larger than the burn duration. For very low mass-flow or effectively massless thrust cases, this can make maneuver-mode BackgroundThrust believe the burn has no remaining time and immediately reduce timewarp.

This patch changes the near-zero-mass-flow branch to return the same absolute time base as the normal branch:

return StartUT + dv * StartMass / thrust;

Fixes an inconsistency in `ThrustParameters.GetUTAtDeltaV()` when vessel mass change is effectively zero.

`GetUTAtDeltaV()` is used as an absolute UT estimate. The normal mass-flow branch returns `StartUT + duration`, but the near-zero-mass-flow branch returned only `duration`:

```csharp
return dv * StartMass / thrust;
```

That causes callers such as maneuver-node thrust integration to compute:

```csharp
remainingT = Math.Max(estimateUT - parameters.StartUT, 0.0);
```

as zero once `StartUT` is larger than the burn duration. For very low mass-flow or effectively massless thrust cases, this can make maneuver-mode BackgroundThrust believe the burn has no remaining time and immediately reduce timewarp.

This patch changes the near-zero-mass-flow branch to return the same absolute time base as the normal branch:

```csharp
return StartUT + dv * StartMass / thrust;
```
@Phantomical

Copy link
Copy Markdown
Owner

You know, I had never managed to reproduce this in a debugger. This makes sense here. Thanks for tracking it down!

@Phantomical
Phantomical merged commit f829fa9 into Phantomical:main Jul 8, 2026
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants