Exemplo n.º 1
0
        protected string GetThrustInfo()
        {
            string output = "";

            if (engineSolver == null || !(engineSolver is SolverRF))
            {
                CreateEngine();
            }
            rfSolver.SetPropellantStatus(true, true);
            // get stats
            double pressure = 101.325d, temperature = 288.15d, density = 1.225d;

            if (Planetarium.fetch != null)
            {
                CelestialBody home = Planetarium.fetch.Home;
                if (home != null)
                {
                    pressure    = home.GetPressure(0d);
                    temperature = home.GetTemperature(0d);
                    density     = home.GetDensity(pressure, temperature);
                }
            }
            ambientTherm = new EngineThermodynamics();
            ambientTherm.FromAmbientConditions(pressure, temperature, density);
            inletTherm = new EngineThermodynamics();
            inletTherm.CopyFrom(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
                double spaceHeight = 131000d;
                pressure = 0d;
                density  = 0d;
                if (Planetarium.fetch != null)
                {
                    CelestialBody home = Planetarium.fetch.Home;
                    if (home != null)
                    {
                        temperature = home.GetTemperature(home.atmosphereDepth + 1d);
                        spaceHeight = home.atmosphereDepth + 1000d;
                    }
                }
                else
                {
                    temperature = PhysicsGlobals.SpaceTemperature;
                }
                ambientTherm.FromAmbientConditions(pressure, temperature, density);
                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);
        }
            protected new string GetThrustInfo()
            {
                string output = "";
                if (engineSolver == null || !(engineSolver is SolverRF))
                    CreateEngine();
                (engineSolver as SolverRF).SetEngineStatus(true, true, true);
                // get stats
                double pressure = 101.325d, temperature = 288.15d, density = 1.225d;
                if (Planetarium.fetch != null)
                {
                    CelestialBody home = Planetarium.fetch.Home;
                    if (home != null)
                    {
                        pressure = home.GetPressure(0d);
                        temperature = home.GetTemperature(0d);
                        density = home.GetDensity(pressure, temperature);
                    }
                }
                ambientTherm = new EngineThermodynamics();
                ambientTherm.FromAmbientConditions(pressure, temperature, density);
                inletTherm = new EngineThermodynamics();
                inletTherm.CopyFrom(ambientTherm);

                currentThrottle = 1f;
                lastPropellantFraction = 1d;
                bool oldE = EngineIgnited;
                EngineIgnited = true;
                (engineSolver as SolverRF).UpdateThrustRatio(1d);

                UpdateFlightCondition(ambientTherm, 0d, Vector3d.zero, 0d, true);
                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
                    double spaceHeight = 131000d;
                    pressure = 0d;
                    density = 0d;
                    if (Planetarium.fetch != null)
                    {
                        CelestialBody home = Planetarium.fetch.Home;
                        if (home != null)
                        {
                            temperature = home.GetTemperature(home.atmosphereDepth + 1d);
                            spaceHeight = home.atmosphereDepth + 1000d;
                        }
                    }
                    else
                        temperature = PhysicsGlobals.SpaceTemperature;
                    ambientTherm.FromAmbientConditions(pressure, temperature, density);

                    UpdateFlightCondition(ambientTherm, spaceHeight, Vector3d.zero, 0d, true);
                    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;
                return output;
            }