protected void GetThrustData(out double thrustVac, out double thrustASL) { rfSolver.SetPropellantStatus(true, true); bool oldE = EngineIgnited; bool oldIg = ignited; float oldThrottle = currentThrottle; double oldLastPropellantFraction = lastPropellantFraction; currentThrottle = 1f; lastPropellantFraction = 1d; EngineIgnited = true; ignited = true; ambientTherm = EngineThermodynamics.StandardConditions(true); inletTherm = ambientTherm; rfSolver.UpdateThrustRatio(1d); rfSolver.SetPropellantStatus(true, true); UpdateSolver(EngineThermodynamics.StandardConditions(true), 0d, Vector3d.zero, 0d, true, true, false); thrustASL = engineSolver.GetThrust() * 0.001d; double spaceHeight = Planetarium.fetch?.Home?.atmosphereDepth + 1000d ?? 141000d; UpdateSolver(EngineThermodynamics.VacuumConditions(true), spaceHeight, Vector3d.zero, 0d, true, true, false); thrustVac = engineSolver.GetThrust() * 0.001d; EngineIgnited = oldE; ignited = oldIg; currentThrottle = oldThrottle; lastPropellantFraction = oldLastPropellantFraction; }
protected string GetThrustInfo() { string output = string.Empty; if (engineSolver == null || !(engineSolver is SolverRF)) { CreateEngine(); } rfSolver.SetPropellantStatus(true, true); ambientTherm = EngineThermodynamics.StandardConditions(true); inletTherm = ambientTherm; currentThrottle = 1f; lastPropellantFraction = 1d; bool oldE = EngineIgnited; EngineIgnited = true; bool oldIg = ignited; ignited = true; rfSolver.UpdateThrustRatio(1d); rfSolver.SetPropellantStatus(true, true); UpdateSolver(ambientTherm, 0d, Vector3d.zero, 0d, true, true, false); double thrustASL = (engineSolver.GetThrust() * 0.001d); var weight = part.mass * (Planetarium.fetch?.Home?.GeeASL * 9.80665 ?? 9.80665); if (atmChangeFlow) // If it's a jet { if (throttleLocked || minThrottle == 1f) { output += String.Format("<b> Static Thrust: </b>{0} (TWR {1}), {2}\n", Utilities.FormatThrust(thrustASL), (thrustASL / weight).ToString("0.0##"), (throttleLocked ? "throttle locked" : "unthrottleable")); } else { output += String.Format("{0}% min throttle\n", (minThrottle * 100f).ToString("N0")); output += String.Format("<b>Max. Static Thrust: </b>{0} (TWR {1})\n", Utilities.FormatThrust(thrustASL), (thrustASL / weight).ToString("0.0##")); output += String.Format("<b>Min. Static Thrust: </b>{0} (TWR {1})\n", Utilities.FormatThrust(thrustASL * minThrottle), (thrustASL * minThrottle / weight).ToString("0.0##")); } if (useVelCurve) // if thrust changes with mach { float vMin, vMax, tMin, tMax; velCurve.FindMinMaxValue(out vMin, out vMax, out tMin, out tMax); // get the max mult, and thus report maximum thrust possible. output += String.Format("<b>Max. Thrust: </b>{0} at Mach {1} (TWR {2})\n", Utilities.FormatThrust(thrustASL * vMax), tMax.ToString("0.#"), (thrustASL * vMax / weight).ToString("0.0##")); } } else { // get stats again ambientTherm = EngineThermodynamics.VacuumConditions(true); double spaceHeight = Planetarium.fetch?.Home?.atmosphereDepth + 1000d ?? 141000d; UpdateSolver(ambientTherm, spaceHeight, Vector3d.zero, 0d, true, true, false); double thrustVac = (engineSolver.GetThrust() * 0.001d); if (throttleLocked || minThrottle == 1f) { var suffix = throttleLocked ? "throttle locked" : "unthrottleable"; if (thrustASL != thrustVac) { output += String.Format("<b>Thrust (Vac): </b>{0} (TWR {1}), {2}\n", Utilities.FormatThrust(thrustVac), (thrustVac / weight).ToString("0.0##"), suffix); output += String.Format("<b>Thrust (ASL): </b>{0} (TWR {1}), {2}\n", Utilities.FormatThrust(thrustASL), (thrustASL / weight).ToString("0.0##"), suffix); } else { output += String.Format("<b>Thrust: </b>{0} (TWR {1}), {2}\n", Utilities.FormatThrust(thrustVac), (thrustVac / weight).ToString("0.0##"), suffix); } } else { output += String.Format("{0}% min throttle\n", (minThrottle * 100f).ToString("N0")); if (thrustASL != thrustVac) { output += String.Format("<b>Max. Thrust (Vac): </b>{0} (TWR {1})\n", Utilities.FormatThrust(thrustVac), (thrustVac / weight).ToString("0.0##")); output += String.Format("<b>Max. Thrust (ASL): </b>{0} (TWR {1})\n", Utilities.FormatThrust(thrustASL), (thrustASL / weight).ToString("0.0##")); output += String.Format("<b>Min. Thrust (Vac): </b>{0} (TWR {1})\n", Utilities.FormatThrust(thrustVac * minThrottle), (thrustVac * minThrottle / weight).ToString("0.0##")); output += String.Format("<b>Min. Thrust (ASL): </b>{0} (TWR {1})\n", Utilities.FormatThrust(thrustASL * minThrottle), (thrustASL * minThrottle / weight).ToString("0.0##")); } else { output += String.Format("<b>Max. Thrust: </b>{0} (TWR {1})\n", Utilities.FormatThrust(thrustVac), (thrustVac / weight).ToString("0.0##")); output += String.Format("<b>Min. Thrust: </b>{0} (TWR {1})\n", Utilities.FormatThrust(thrustVac * minThrottle), (thrustVac * minThrottle / weight).ToString("0.0##")); } } } EngineIgnited = oldE; ignited = oldIg; return(output); }
protected string GetThrustInfo() { string output = string.Empty; if (engineSolver == null || !(engineSolver is SolverRF)) { CreateEngine(); } rfSolver.SetPropellantStatus(true, true); ambientTherm = EngineThermodynamics.StandardConditions(true); inletTherm = ambientTherm; currentThrottle = 1f; lastPropellantFraction = 1d; bool oldE = EngineIgnited; EngineIgnited = true; bool oldIg = ignited; ignited = true; rfSolver.UpdateThrustRatio(1d); rfSolver.SetPropellantStatus(true, true); UpdateSolver(ambientTherm, 0d, Vector3d.zero, 0d, true, true, false); double thrustASL = (engineSolver.GetThrust() * 0.001d); if (atmChangeFlow) // If it's a jet { output += "<b>Static Thrust: </b>" + (thrustASL).ToString("0.0##") + " kN" + ThrottleString(); if (useVelCurve) // if thrust changes with mach { float vMin, vMax, tMin, tMax; velCurve.FindMinMaxValue(out vMin, out vMax, out tMin, out tMax); // get the max mult, and thus report maximum thrust possible. output += "\n<b>Max. Thrust: </b>" + (thrustASL * vMax).ToString("0.0##") + " kN Mach " + tMax.ToString("0.#"); } } else { // get stats again ambientTherm = EngineThermodynamics.VacuumConditions(true); double spaceHeight = Planetarium.fetch?.Home?.atmosphereDepth + 1000d ?? 141000d; UpdateSolver(ambientTherm, spaceHeight, Vector3d.zero, 0d, true, true, false); double thrustVac = (engineSolver.GetThrust() * 0.001d); if (thrustASL != thrustVac) { output += (throttleLocked ? "<b>" : "<b>Max. ") + "Thrust (Vac.): </b>" + (thrustVac).ToString("0.0##") + " kN" + ThrottleString() + "\n" + (throttleLocked ? "<b>" : "<b>Max. ") + "Thrust (ASL): </b>" + (thrustASL).ToString("0.0##") + " kN"; } else { output += (throttleLocked ? "<b>" : "<b>Max. ") + "Thrust: </b>" + (thrustVac).ToString("0.0##") + " kN" + ThrottleString(); } } output += "\n"; EngineIgnited = oldE; ignited = oldIg; return(output); }