MechJeb2

MechJeb2

4M Downloads

Thrust computation in stage stats is wrong for engines with non-ISP fuel (HTP)

lamont-granquist opened this issue ยท 5 comments

commented

got an RD-108_8D75 here which should have 311 Vac ISP and 936.2 kN thrust, and it has 311.0001 Vac ISP correctly, but has 962 kN thrust reported in stage stats.

commented

nevermind, looking at the wrong stage there, no RCS involved.
commented

Yeah, KSP shows 935.7kN vac on the tooltip, while FuelFlowSimulation stage stats is coming up with 962.18 kN, and its the only active engine.

And it looks like the vac stats shows 962.18dV for it, while the "live atmo stats" while in actual vacuum are 962.18dV as well, so its not something wonky with the atmo calcs.

This is for @NathanKell's Centepede 2 ship with the SSTU-SC-ENG-RD-108A engine.

commented

And I'm building on top of be8c3a2 which is current with origin/dev

commented

NK reminds me that the ISP is also wrong, since it should be a lower ISP overall than the 311 because that number is the nozzle ISP of the burned fuel and the HTP consumption will drop the effective ISP down.

It looks like the thrust and ISP fields are calculated separately:

public double EngineThrust(float throttle, double atmospheres, double atmDensity, double machNumber)
{
float Isp = atmosphereCurve.Evaluate((float)atmospheres);
double flowModifier = GetFlowModifier(atmDensity, machNumber);
double thrust = Mathf.Lerp(minFuelFlow, maxFuelFlow, throttle * 0.01f * thrustPercentage) * flowModifier * Isp * g;
return thrust * fwdThrustRatio;
}

The prior patch fixed the actual fuel flow / resource consumption simulation and the delta-V calculation, but those two fields were never fixed.

EDIT: whoah, first time i've seen the code blocks expanded inline in a comment...

commented

fixed.