/// Returns the standard pressure at the specified altitude. public virtual double GetStdPressure(double altitude) { double GeoPotAlt = GeopotentialAltitude(altitude); // Iterate through the altitudes to find the current Base Altitude // in the table. That is, if the current altitude (the argument passed in) // is 20000 ft, then the base altitude from the table is 0.0. If the // passed-in altitude is 40000 ft, the base altitude is 36089.2388 ft (and // the index "b" is 2 - the second entry in the table). double BaseAlt = StdAtmosTemperatureTable.GetElement(1, 0); int numRows = StdAtmosTemperatureTable.GetNumRows(); int b; for (b = 0; b < numRows - 2; ++b) { double testAlt = StdAtmosTemperatureTable.GetElement(b + 2, 0); if (GeoPotAlt < testAlt) { break; } BaseAlt = testAlt; } double Tmb = GetStdTemperature(GeometricAltitude(BaseAlt)); double deltaH = GeoPotAlt - BaseAlt; double Lmb = LapseRates[b]; if (Lmb != 0.0) { double Exp = Constants.g0 / (Rdry * Lmb); double factor = Tmb / (Tmb + Lmb * deltaH); return(StdPressureBreakpoints[b] * Math.Pow(factor, Exp)); } else { return(StdPressureBreakpoints[b] * Math.Exp(-Constants.g0 * deltaH / (Rdry * Tmb))); } }
/// Destructor //virtual ~FGStandardAtmosphere(); public override bool InitModel() { // Assume the altitude to fade out the gradient at is at the highest // altitude in the table. Above that, other functions are used to // calculate temperature. gradientFadeoutAltitude = StdAtmosTemperatureTable.GetElement(StdAtmosTemperatureTable.GetNumRows(), 0); temperatureDeltaGradient = 0.0; temperatureBias = 0.0; LapseRates = StdLapseRates; PressureBreakpoints = StdPressureBreakpoints; SLpressure = StdSLpressure; SLtemperature = StdSLtemperature; SLdensity = StdSLdensity; SLsoundspeed = StdSLsoundspeed; Calculate(0.0); // PrintStandardAtmosphereTable(); return(true); }