1
0
Fork 0

Use factors instead of offset in atmosphere model. The troposphere is

hard-coded for 38,000ft.
This commit is contained in:
david 2002-06-05 22:30:07 +00:00
parent 34e2e52158
commit 2df334378f

View file

@ -269,31 +269,31 @@ FGEnvironment::set_elevation_ft (double e)
// R=287. I chose to correct the temperature to 288.20, since 79F is // R=287. I chose to correct the temperature to 288.20, since 79F is
// pretty hot for a "standard" atmosphere. // pretty hot for a "standard" atmosphere.
// Elevation (ft), delta temperature (degC), delta pressure (inHG), // Elevation (ft), temperature factor (degK), pressure factor (inHG),
// delta density (slug/ft^3) // density factor (slug/ft^3)
static double atmosphere_data[][4] = { static double atmosphere_data[][4] = {
0, 0.00, 0.000, 0.000000, 0.00, 1.00, 1.000, 1.000000,
2952, -5.89, -3.058, -0.000198, 2952.76, 0.98, 0.898, 0.916408,
5905, -11.74, -5.856, -0.000384, 5905.51, 0.96, 0.804, 0.838286,
8858, -17.58, -8.413, -0.000556, 8858.27, 0.94, 0.719, 0.765429,
11811, -23.43, -10.745, -0.000717, 11811.02, 0.92, 0.641, 0.697510,
14763, -29.27, -12.867, -0.000867, 14763.78, 0.90, 0.570, 0.634318,
17716, -35.11, -14.794, -0.001006, 17716.54, 0.88, 0.506, 0.575616,
20669, -40.95, -16.541, -0.001136, 20669.29, 0.86, 0.447, 0.521184,
23622, -46.79, -18.120, -0.001255, 23622.05, 0.84, 0.394, 0.470784,
26574, -52.62, -19.544, -0.001366, 26574.80, 0.82, 0.347, 0.424220,
29527, -58.46, -20.826, -0.001467, 29527.56, 0.80, 0.304, 0.381273,
32480, -64.29, -21.976, -0.001561, 32480.31, 0.78, 0.266, 0.341747,
35433, -70.12, -23.005, -0.001647, 35433.07, 0.76, 0.231, 0.305445,
38385, -71.54, -23.916, -0.001739, 38385.83, 0.75, 0.201, 0.266931,
41338, -71.54, -24.708, -0.001822, 41338.58, 0.75, 0.174, 0.231739,
44291, -71.54, -25.395, -0.001894, 44291.34, 0.75, 0.151, 0.201192,
47244, -71.54, -25.991, -0.001957, 47244.09, 0.75, 0.131, 0.174686,
50196, -71.54, -26.509, -0.002012, 50196.85, 0.75, 0.114, 0.151673,
53149, -71.54, -26.959, -0.002059, 53149.61, 0.75, 0.099, 0.131698,
56102, -71.54, -27.349, -0.002100, 56102.36, 0.75, 0.086, 0.114359,
59055, -71.54, -27.687, -0.002136, 59055.12, 0.75, 0.075, 0.099306,
62007, -71.54, -27.981, -0.002167, 62007.87, 0.75, 0.065, 0.086237,
-1, -1, -1, -1 -1, -1, -1, -1
}; };
@ -348,47 +348,53 @@ FGEnvironment::_recalc_ne ()
void void
FGEnvironment::_recalc_sl_temperature () FGEnvironment::_recalc_sl_temperature ()
{ {
// If we're in the stratosphere, leave sea-level temp alone
if (elevation_ft < 38000) { if (elevation_ft < 38000) {
temperature_sea_level_degc = temperature_sea_level_degc =
temperature_degc - _temperature_degc_table->interpolate(elevation_ft); (temperature_degc + 273.15)
/_temperature_degc_table->interpolate(elevation_ft)
- 273.15;
} }
// If we're in the stratosphere, leave sea-level temp alone
} }
void void
FGEnvironment::_recalc_alt_temperature () FGEnvironment::_recalc_alt_temperature ()
{ {
if (elevation_ft < 38000) {
temperature_degc = temperature_degc =
temperature_sea_level_degc + (temperature_sea_level_degc + 273.15) *
_temperature_degc_table->interpolate(elevation_ft); _temperature_degc_table->interpolate(elevation_ft) - 273.15;
} else {
temperature_degc = -56.49; // Stratosphere is constant
}
} }
void void
FGEnvironment::_recalc_sl_pressure () FGEnvironment::_recalc_sl_pressure ()
{ {
pressure_sea_level_inhg = pressure_sea_level_inhg =
pressure_inhg - _pressure_inhg_table->interpolate(elevation_ft); pressure_inhg / _pressure_inhg_table->interpolate(elevation_ft);
} }
void void
FGEnvironment::_recalc_alt_pressure () FGEnvironment::_recalc_alt_pressure ()
{ {
pressure_inhg = pressure_inhg =
pressure_sea_level_inhg + _pressure_inhg_table->interpolate(elevation_ft); pressure_sea_level_inhg * _pressure_inhg_table->interpolate(elevation_ft);
} }
void void
FGEnvironment::_recalc_sl_density () FGEnvironment::_recalc_sl_density ()
{ {
density_sea_level_slugft3 = density_sea_level_slugft3 =
density_slugft3 - _density_slugft3_table->interpolate(elevation_ft); density_slugft3 / _density_slugft3_table->interpolate(elevation_ft);
} }
void void
FGEnvironment::_recalc_alt_density () FGEnvironment::_recalc_alt_density ()
{ {
density_slugft3 = density_slugft3 =
density_sea_level_slugft3 + density_sea_level_slugft3 *
_density_slugft3_table->interpolate(elevation_ft); _density_slugft3_table->interpolate(elevation_ft);
} }