1
0
Fork 0

Revert the recent changes to Atmosphere.cpp. They were actually in

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.
This commit is contained in:
andy 2002-05-16 07:49:22 +00:00
parent 99859a5ea9
commit 4efbc97a4b
2 changed files with 8 additions and 27 deletions

View 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)

View 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));