camlost2 / AJE

Advanced Jet Engine for KSP
8 stars 10 forks source link

Specific impulse / fuel flow wrong with non-optimal intake area #29

Closed mjn33 closed 9 years ago

mjn33 commented 9 years ago

Operating System: Fedora 21 (Linux) x86-64

AJE Version: Commit 381dcd190880d82f670c0dbda8078eecff513a56

Reproduction steps:

  1. Launch AJEtest1.craft from the VAB/SPH
  2. Stage to start the engines, throttle to 100%
  3. Observe the right-click GUI menu on the engine (screenshot8.png)
  4. Close one of the intakes
  5. Observe the right-click GUI menu again (screenshot9.png)

Specific impulse and mass flow stay the same, however thrust is lower. This would seem to related to a comment at SolverJet.cs#L268.

Maybe something like what is shown below would work? (Assuming specific impulse should stay the same)

diff --git a/Source/SolverJet.cs b/Source/SolverJet.cs
index 32923de..f10b9d2 100644
--- a/Source/SolverJet.cs
+++ b/Source/SolverJet.cs
@@ -261,11 +261,10 @@ public override void CalculatePerformance(double airRatio, double commandedThrot
                     thrust -= bypassAirFlow * vel;
                 }

-                thrust *= flowMult * ispMult;
-                fuelFlow = mdot * th7.FF * flowMult;
+                thrust *= flowMult * ispMult * airRatio;
+                fuelFlow = mdot * th7.FF * flowMult * airRatio;
                 Isp = thrust / (fuelFlow * 9.80665);
                 SFC = 3600d / Isp;
-                thrust *= airRatio; // FIXME: should this get applied to fuel flow and Isp too?

                 /*  
                   debugstring = "";

All files: screenshot8.png screenshot9.png AJEtest1.craft Player.log

mjn33 commented 9 years ago

Pinging @NathanKell and @blowfishpro

blowfishpro commented 9 years ago

Acknowledged. I think the proper thing to do is to cut the total pressure at the inlet when the intake ratio is insufficient. I'll look at implementing this in a day or two.

blowfishpro commented 9 years ago

I've implemented the fix and it seems to be working properly.

Only issue is that it can cause negative static thrust if intake ratio is low enough, but that can also be caused by low throttle even with 100% area. The root cause is that the pressure inside the turbine is less than ambient pressure. Once I figure out how to fix this in the low throttle regime, I'll probably set the engine to flame out if this condition is met anywhere else.