]> git.mxchange.org Git - flightgear.git/commitdiff
Revert the recent changes to Atmosphere.cpp. They were actually in
authorandy <andy>
Thu, 16 May 2002 07:49:22 +0000 (07:49 +0000)
committerandy <andy>
Thu, 16 May 2002 07:49:22 +0000 (07:49 +0000)
the wrong place.  The Atmosphere::getStd*() calls are used by the
solver, and thus really need to return values for a "standard"
atmosphere.  Otherwise, an aircraft started up in Moscow will behave
differently than one initialized in Cairo. :)

The place where environmental pressure and temperature get inspected
at runtime is in YASim.cxx.  The changes there, happily, end up being
even smaller than the ones to Atmosphere.  This ends up replacing code
only, and removing some comments.

src/FDM/YASim/Atmosphere.cpp
src/FDM/YASim/YASim.cxx

index bc8a754dd780e74f41d303cecb0a08284bd0851c..18b54dd2431a0df84398175ffea428e29fcbc453 100644 (file)
@@ -1,5 +1,3 @@
-#include <Main/fg_props.hxx>
-
 #include "Math.hpp"
 #include "Atmosphere.hpp"
 namespace yasim {
@@ -42,26 +40,17 @@ const float GAMMA = 1.4f;
 
 float Atmosphere::getStdTemperature(float alt)
 {
-    if (fgGetBool("/environment/params/control-fdm-atmosphere"))
-        return fgGetDouble("/environment/temperature-degC") + 273.15;
-    else
-        return getRecord(alt, 1);
+    return getRecord(alt, 1);
 }
 
 float Atmosphere::getStdPressure(float alt)
 {
-    if (fgGetBool("/environment/params/control-fdm-atmosphere"))
-        return fgGetDouble("/environment/pressure-inhg") * 3386.39;
-    else
-        return getRecord(alt, 2);
+    return getRecord(alt, 2);
 }
 
 float Atmosphere::getStdDensity(float alt)
 {
-    if (fgGetBool("/environment/params/control-fdm-atmosphere"))
-        return fgGetDouble("/environment/density-slugft3") * 515.378;
-    else
-        return getRecord(alt, 3);
+    return getRecord(alt, 3);
 }
 
 float Atmosphere::calcVEAS(float spd, float pressure, float temp)
index 6a6ba7971f87242d06a4ca17413bf45ed6feb306..2c87d1baf497a5f083181ca7d259e8d1d7d57718 100644 (file)
@@ -28,6 +28,7 @@ static const float MPS2KTS = 3600.0/1852.0;
 static const float CM2GALS = 264.172037284; // gallons/cubic meter
 static const float KG2LBS = 2.20462262185;
 static const float W2HP = 1.3416e-3;
+static const float INHG2PA = 3386.389;
 
 void YASim::printDEBUG()
 {
@@ -235,15 +236,9 @@ void YASim::copyToYASim(bool copyState)
     // from the scenery and set it for others to find.
     double ground = globals->get_scenery()->get_cur_elev();
     _set_Runway_altitude(ground * FT2M);
-    // cout << "YASIM: ground = " << ground << endl;
 
-    // You'd this this would work, but it doesn't.  These values are
-    // always zero.  Use a "standard" pressure intstead.
-    //
-    // float pressure = get_Static_pressure();
-    // float temp = get_Static_temperature();
-    float pressure = Atmosphere::getStdPressure(alt);
-    float temp = Atmosphere::getStdTemperature(alt);
+    float pressure = fgGetDouble("/environment/pressure-inhg") * INHG2PA;
+    float temp = fgGetDouble("/environment/temperature-degC") + 273.15;
 
     // Convert and set:
     Model* model = _fdm->getAirplane()->getModel();
@@ -373,11 +368,8 @@ void YASim::copyFromYASim()
     _set_V_rel_wind(Math::mag3(v)*M2FT); // units?
 
 
-    // These don't work, use a dummy based on altitude
-    // float P = get_Static_pressure();
-    // float T = get_Static_temperature();
-    float P = Atmosphere::getStdPressure(alt);
-    float T = Atmosphere::getStdTemperature(alt);
+    float P = fgGetDouble("/environment/pressure-inhg") * INHG2PA;
+    float T = fgGetDouble("/environment/temperature-degC") + 273.15;
     _set_V_equiv_kts(Atmosphere::calcVEAS(v[0], P, T)*MPS2KTS);
     _set_V_calibrated_kts(Atmosphere::calcVCAS(v[0], P, T)*MPS2KTS);
     _set_Mach_number(Atmosphere::calcMach(v[0], T));