+\f
+////////////////////////////////////////////////////////////////////////
+// Atmosphere model.
+////////////////////////////////////////////////////////////////////////
+
+// Copied from YASim Atmosphere.cxx, with m converted to ft, degK
+// converted to degC, Pa converted to inHG, and kg/m^3 converted to
+// slug/ft^3; they were then converted to deltas from the sea-level
+// defaults (approx. 15degC, 29.92inHG, and 0.00237slugs/ft^3).
+
+// Original comment from YASim:
+
+// Copied from McCormick, who got it from "The ARDC Model Atmosphere"
+// Note that there's an error in the text in the first entry,
+// McCormick lists 299.16/101325/1.22500, but those don't agree with
+// R=287. I chose to correct the temperature to 288.20, since 79F is
+// pretty hot for a "standard" atmosphere.
+
+// Elevation (ft), temperature factor (degK), pressure factor (inHG)
+static double atmosphere_data[][3] = {
+ { 0.00, 1.00, 1.000 },
+ { 2952.76, 0.98, 0.898 },
+ { 5905.51, 0.96, 0.804 },
+ { 8858.27, 0.94, 0.719 },
+ { 11811.02, 0.92, 0.641 },
+ { 14763.78, 0.90, 0.570 },
+ { 17716.54, 0.88, 0.506 },
+ { 20669.29, 0.86, 0.447 },
+ { 23622.05, 0.84, 0.394 },
+ { 26574.80, 0.82, 0.347 },
+ { 29527.56, 0.80, 0.304 },
+ { 32480.31, 0.78, 0.266 },
+ { 35433.07, 0.76, 0.231 },
+ { 38385.83, 0.75, 0.201 },
+ { 41338.58, 0.75, 0.174 },
+ { 44291.34, 0.75, 0.151 },
+ { 47244.09, 0.75, 0.131 },
+ { 50196.85, 0.75, 0.114 },
+ { 53149.61, 0.75, 0.099 },
+ { 56102.36, 0.75, 0.086 },
+ { 59055.12, 0.75, 0.075 },
+ { 62007.87, 0.75, 0.065 },
+ { -1, -1, -1 }
+};
+
+static SGInterpTable * _temperature_degc_table = 0;
+static SGInterpTable * _pressure_inhg_table = 0;
+
+static void
+_setup_tables ()
+{
+ if (_temperature_degc_table != 0)
+ return;
+
+ _temperature_degc_table = new SGInterpTable;
+ _pressure_inhg_table = new SGInterpTable;
+
+ for (int i = 0; atmosphere_data[i][0] != -1; i++) {
+ _temperature_degc_table->addEntry(atmosphere_data[i][0],
+ atmosphere_data[i][1]);
+ _pressure_inhg_table->addEntry(atmosphere_data[i][0],
+ atmosphere_data[i][2]);
+ }
+}
+
+
+\f
+////////////////////////////////////////////////////////////////////////
+// Implementation of FGEnvironment.
+////////////////////////////////////////////////////////////////////////
+