예제 #1
0
        public void updateIspEngineParams(double athmosphere_isp_efficiency = 1, double max_thrust_in_space = 0)
        {
            // recaculate ISP based on power and core temp available
            FloatCurve newISP = new FloatCurve();
            FloatCurve vCurve = new FloatCurve();

            maxISP = (float)(Math.Sqrt((double)myAttachedReactor.CoreTemperature) * (PluginHelper.IspCoreTempMult + IspTempMultOffset) * GetIspPropellantModifier());

            if (!currentpropellant_is_jet)
            {
                if (maxPressureTresholdAtKerbinSurface <= max_thrust_in_space && FlightGlobals.getStaticPressure(vessel.transform.position) <= 1)
                {
                    var min_engine_thrust        = Math.Max(max_thrust_in_space - maxPressureTresholdAtKerbinSurface, 0.00001);
                    var minThrustAtmosphereRatio = min_engine_thrust / Math.Max(max_thrust_in_space, 0.000001);
                    minISP = maxISP * (float)minThrustAtmosphereRatio * heatExchangerThrustDivisor;
                    newISP.Add(0, Mathf.Min(maxISP, PluginHelper.MaxThermalNozzleIsp), 0, 0);
                    newISP.Add(1, Mathf.Min(minISP, PluginHelper.MaxThermalNozzleIsp), 0, 0);
                }
                else
                {
                    newISP.Add(0, Mathf.Min(maxISP * (float)athmosphere_isp_efficiency, PluginHelper.MaxThermalNozzleIsp), 0, 0);
                }

                myAttachedEngine.useVelocityCurve      = false;
                myAttachedEngine.useEngineResponseTime = false;
            }
            else
            {
                if (myAttachedReactor.shouldScaleDownJetISP())
                {
                    maxISP = maxISP * 2.0f / 3.0f;
                    if (maxISP > 300)
                    {
                        maxISP = maxISP / 2.5f;
                    }
                }
                newISP.Add(0, Mathf.Min(maxISP * 4.0f / 5.0f, PluginHelper.MaxThermalNozzleIsp));
                newISP.Add(0.15f, Mathf.Min(maxISP, PluginHelper.MaxThermalNozzleIsp));
                newISP.Add(0.3f, Mathf.Min(maxISP * 4.0f / 5.0f, PluginHelper.MaxThermalNozzleIsp));
                newISP.Add(1, Mathf.Min(maxISP * 2.0f / 3.0f, PluginHelper.MaxThermalNozzleIsp));
                vCurve.Add(0, 1.0f);
                vCurve.Add((float)(maxISP * PluginHelper.GravityConstant * 1.0 / 3.0), 1.0f);
                vCurve.Add((float)(maxISP * PluginHelper.GravityConstant), 1.0f);
                vCurve.Add((float)(maxISP * PluginHelper.GravityConstant * 4.0 / 3.0), 0);
                myAttachedEngine.useVelocityCurve      = true;
                myAttachedEngine.useEngineResponseTime = true;
                myAttachedEngine.ignitionThreshold     = 0.01f;
            }

            myAttachedEngine.atmosphereCurve = newISP;
            myAttachedEngine.velocityCurve   = vCurve;
            assThermalPower = myAttachedReactor.MaximumPower;
            if (myAttachedReactor is InterstellarFusionReactor)
            {
                assThermalPower = assThermalPower * 0.95f;
            }
        }
예제 #2
0
        public void updateIspEngineParams()
        {
            // recaculate ISP based on power and core temp available
            FloatCurve newISP = new FloatCurve();
            FloatCurve vCurve = new FloatCurve();

            maxISP = (float)(Math.Sqrt((double)myAttachedReactor.CoreTemperature) * isp_temp_rat * ispMultiplier);

            if (!currentpropellant_is_jet)
            {
                minISP = maxISP * 0.4f;
                newISP.Add(0, Mathf.Min(maxISP, 2997.13f), 0, 0);
                newISP.Add(1, Mathf.Min(minISP, 2997.13f), 0, 0);
                myAttachedEngine.useVelocityCurve      = false;
                myAttachedEngine.useEngineResponseTime = false;
            }
            else
            {
                if (myAttachedReactor.shouldScaleDownJetISP())
                {
                    maxISP = maxISP * 2.0f / 3.0f;
                    if (maxISP > 300)
                    {
                        maxISP = maxISP / 2.5f;
                    }
                }
                newISP.Add(0, Mathf.Min(maxISP * 4.0f / 5.0f, 2997.13f));
                newISP.Add(0.15f, Mathf.Min(maxISP, 2997.13f));
                newISP.Add(0.3f, Mathf.Min(maxISP * 4.0f / 5.0f, 2997.13f));
                newISP.Add(1, Mathf.Min(maxISP * 2.0f / 3.0f, 2997.13f));
                vCurve.Add(0, 1.0f);
                vCurve.Add((float)(maxISP * g0 * 1.0 / 3.0), 1.0f);
                vCurve.Add((float)(maxISP * g0), 1.0f);
                vCurve.Add((float)(maxISP * g0 * 4.0 / 3.0), 0);
                myAttachedEngine.useVelocityCurve      = true;
                myAttachedEngine.useEngineResponseTime = true;
                myAttachedEngine.ignitionThreshold     = 0.01f;
            }

            myAttachedEngine.atmosphereCurve = newISP;
            myAttachedEngine.velocityCurve   = vCurve;
            assThermalPower = myAttachedReactor.MaximumPower;
            if (myAttachedReactor is InterstellarFusionReactor)
            {
                assThermalPower = assThermalPower * 0.95f;
            }
        }