-#include <Main/fg_props.hxx>
-
#include "Math.hpp"
#include "Atmosphere.hpp"
namespace yasim {
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)
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()
{
// 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();
_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));