MechJeb2

MechJeb2

4M Downloads

Atmospheric density conversion in StageStats seems applied twice

lamont-granquist opened this issue · 0 comments

commented

In the calling computer module there's a conversion of 1/1.225 which is equivalent to multiplying by 40/49:

double atmDensity = (HighLogic.LoadedSceneIsEditor || !liveSLT ? simBody.GetDensity(simBody.GetPressure(altSLT), simBody.GetTemperature(0)) : vessel.atmDensity) / 1.225;

Then that atmDensity value goes through all of FuelFlowSimulation and the FuelNode without change as far as I can tell. Ultimately we wind up in the PartExtensions that handle the *AtConditions() API where it gets multipied again by 40/49 in a few places:

https://github.com/MuMech/MechJeb2/blob/dev/MechJeb2/PartExtensions.cs#L84-L86

https://github.com/MuMech/MechJeb2/blob/dev/MechJeb2/PartExtensions.cs#L118

That seems like it is getting double-converted unless I'm missing something this morning and I'm too low on ☕ for this code.