protected void CalculateTTR() { //calculate TTR at design point first // Don't overwrite th0 and th1 EngineThermodynamics ambientTherm = EngineThermodynamics.StandardConditions(false); ambientTherm.T = T_d; EngineThermodynamics inletTherm = ambientTherm.ChangeReferenceFrameMach(M_d); // Note that this work is negative // Different mass flows between compressor, turbine, and bypass automatically taken care of by MassRatio double compressorWork; th3 = inletTherm.AdiabaticProcessWithPressureRatio(CPR, out compressorWork, efficiency: eta_c); double fanWork = 0d; if (BPR > 0d) { th2 = inletTherm.AdiabaticProcessWithPressureRatio(FPR, out fanWork, efficiency: eta_c); fanWork *= BPR; fanWorkConstant = fanWork / compressorWork; } double turbineWork = compressorWork + fanWork; th4 = th3.AddFuelToTemperature(Tt4, h_f); th5 = th4.AdiabaticProcessWithWork(turbineWork, efficiency: eta_t); TTR = th5.T / th4.T; }
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; }
private void SetStaticSimulation() { ambientTherm = EngineThermodynamics.StandardConditions(true); inletTherm = ambientTherm; inletTherm.P *= AJEInlet.OverallStaticTPR(defaultTPR); areaRatio = 1d; lastPropellantFraction = 1d; }
protected void InitializeEngine() { //calculate TTR at design point first // Don't overwrite th0 and th1 EngineThermodynamics ambientTherm = EngineThermodynamics.StandardConditions(false); ambientTherm.T = T_d; EngineThermodynamics inletTherm = ambientTherm.ChangeReferenceFrameMach(M_d); th7 = inletTherm.AddFuelToTemperature(9999d, h_f, throttle: throttle, maxFar: maxFar); th7.P *= 0.95; double massFlow = inletTherm.CalculateMassFlow(Aref, 0.5d); Athroat = th7.CalculateFlowArea(massFlow * th7.MassRatio, 1d); if (!adjustableNozzle) { p8 = ambientTherm.P; CalculateANozzle(); } }
public string GetStaticThrustInfo() { string output = ""; if (engineSolver == null || !(engineSolver is SolverRotor)) { CreateEngine(); } // get stats ambientTherm = EngineThermodynamics.StandardConditions(true); currentThrottle = 1f; lastPropellantFraction = 1d; UpdateSolver(ambientTherm, 0d, Vector3.zero, 0d, true, true, false); double thrust = (engineSolver.GetThrust() * 0.001d); double power = ((engineSolver as SolverRotor).GetPower() / 745.7d); output += "<b>Static Power: </b>" + power.ToString("F0") + " HP\n"; output += "<b>Static Thrust: </b>" + thrust.ToString("F2") + " kN\n"; 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); 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); }