Exemplo n.º 1
0
 virtual public void UpdateFlightCondition()
 {
     ambientTherm = EngineThermodynamics.VesselAmbientConditions(vessel, useExtTemp);
 }
Exemplo n.º 2
0
        private void FixedUpdate()
        {
            if (!HighLogic.LoadedSceneIsFlight || !vessel)
            {
                return;
            }
            if (vessel.altitude > vessel.mainBody.atmosphereDepth)
            {
                return;
            }
            int newCount = vessel.Parts.Count;

            if (partsCount != newCount)
            {
                partsCount = newCount;
                UpdatePartsList();
            }


            InletArea  = 0d;
            EngineArea = 0d;
            OverallTPR = 0d;
            AreaRatio  = 0d;

            for (int j = engineList.Count - 1; j >= 0; --j)
            {
                ModuleEnginesSolver e = engineList[j];
                if ((object)e != null && e.EngineIgnited)
                {
                    EngineArea += e.Need_Area;
                }
            }

            for (int j = inletList.Count - 1; j >= 0; --j)
            {
                AJEInlet i = inletList[j];
                if ((object)i != null)
                {
                    double area = i.UsableArea();
                    InletArea  += area;
                    OverallTPR += area * i.overallTPR;
                }
            }

            if (InletArea > 0d)
            {
                if (EngineArea > 0d)
                {
                    AreaRatio   = Math.Min(1d, InletArea / EngineArea);
                    OverallTPR /= InletArea;
                    OverallTPR *= AreaRatio;
                }
                else
                {
                    AreaRatio = 1d;
                }
            }

            AmbientTherm = EngineThermodynamics.VesselAmbientConditions(vessel);
            Mach         = vessel.mach;

            // Transform from static frame to vessel frame, increasing total pressure and temperature
            if (vessel.srfSpeed < 0.01d)
            {
                InletTherm = AmbientTherm;
            }
            else
            {
                InletTherm = AmbientTherm.ChangeReferenceFrame(vessel.srfSpeed);
            }
            InletTherm.P *= OverallTPR; // TPR accounts for loss of total pressure by inlet

            // Push parameters to each engine

            for (int i = engineList.Count - 1; i >= 0; --i)
            {
                engineList[i].UpdateInletEffects(InletTherm, AreaRatio, OverallTPR);
            }
        }