41#include "models/FGModel.h"
80 enum eTemperature {eNoTempUnit=0, eFahrenheit, eCelsius, eRankine, eKelvin};
83 enum ePressure {eNoPressUnit=0, ePSF, eMillibars, ePascals, eInchesHg};
98 bool Run(
bool Holding)
override;
100 bool InitModel(
void)
override;
131 virtual void SetTemperatureSL(
double t, eTemperature unit=eFahrenheit);
150 virtual double GetPressureSL(
ePressure to=ePSF)
const {
return ConvertFromPSF(SLpressure, to); }
159 virtual void SetPressureSL(ePressure unit,
double pressure);
170 virtual double GetDensity(
double altitude)
const;
186 virtual double GetSoundSpeed(
double altitude)
const;
205 virtual double GetDensityAltitude()
const {
return DensityAltitude;}
207 virtual double GetPressureAltitude()
const {
return PressureAltitude;}
211 double GeodLatitudeDeg;
215 static constexpr double StdDaySLtemperature = 518.67;
216 static constexpr double StdDaySLpressure = 2116.228;
217 const double StdDaySLsoundspeed;
218 static constexpr double SHRatio = 1.4;
222 double SLtemperature = 1.8;
223 double SLdensity = 1.0;
224 double SLpressure = 1.0;
225 double SLsoundspeed = 1.0;
227 double Temperature = 1.8;
228 double Density = 0.0;
229 double Pressure = 0.0;
230 double Soundspeed = 0.0;
231 double PressureAltitude = 0.0;
232 double DensityAltitude = 0.0;
234 static constexpr double SutherlandConstant = 198.72;
235 static constexpr double Beta = 2.269690E-08;
236 double Viscosity = 0.0;
237 double KinematicViscosity = 0.0;
240 virtual void Calculate(
double altitude);
257 double ConvertToRankine(
double t, eTemperature unit)
const;
260 double ConvertFromRankine(
double t, eTemperature unit)
const;
263 double ConvertToPSF(
double t, ePressure unit=ePSF)
const;
266 double ConvertFromPSF(
double t, ePressure unit=ePSF)
const;
271 double ValidatePressure(
double p,
const std::string& msg,
bool quiet=
false)
const;
276 double ValidateTemperature(
double t,
const std::string& msg,
bool quiet=
false)
const;
281 static constexpr double Rstar = 8.31432 * kgtoslug / KelvinToRankine(fttom * fttom);
283 static constexpr double Mair = 28.9645 * kgtoslug / 1000.0;
289 static constexpr double g0 = 9.80665 / fttom;
291 static constexpr double Reng0 = Rstar / Mair;
296 virtual void bind(
void);
297 void Debug(
int from)
override;
300 static constexpr double StdDaySLdensity = StdDaySLpressure / (Reng0 * StdDaySLtemperature);
Models an empty, abstract base atmosphere class.
virtual double GetSoundSpeedRatio(void) const
Returns the ratio of at-altitude sound speed over the sea level value.
virtual double GetPressureRatio(void) const
Returns the ratio of at-altitude pressure over the sea level value.
virtual double GetTemperatureRatio() const
Returns the ratio of the at-current-altitude temperature as modeled over the sea level value.
virtual double CalculatePressureAltitude(double pressure, double geometricAlt)
Calculates the pressure altitude given any temperature or pressure bias.
virtual double GetPressure(double altitude) const =0
Returns the pressure at a specified altitude in psf.
virtual double GetPressure(void) const
Returns the pressure in psf.
virtual double GetSoundSpeedSL(void) const
Returns the sea level speed of sound in ft/sec.
eTemperature
Enums for specifying temperature units.
virtual double GetTemperature(double altitude) const =0
Returns the actual modeled temperature in degrees Rankine at a specified altitude.
virtual double GetKinematicViscosity(void) const
Returns the kinematic viscosity.
virtual double CalculateDensityAltitude(double density, double geometricAlt)
Calculates the density altitude given any temperature or pressure bias.
virtual double GetSoundSpeed(void) const
Returns the speed of sound in ft/sec.
virtual double GetDensitySL(void) const
Returns the sea level density in slugs/ft^3.
ePressure
Enums for specifying pressure units.
virtual double GetTemperatureSL() const
Returns the actual, modeled sea level temperature in degrees Rankine.
virtual double GetTemperatureRatio(double h) const
Returns the ratio of the temperature as modeled at the supplied altitude over the sea level value.
virtual double GetDensityRatio(void) const
Returns the ratio of at-altitude density over the sea level value.
virtual void SetTemperature(double t, double h, eTemperature unit=eFahrenheit)=0
Sets the temperature at the supplied altitude.
virtual double GetAbsoluteViscosity(void) const
Returns the absolute viscosity.
virtual double GetDensity(void) const
Returns the density in slugs/ft^3.
virtual double GetTemperature() const
Returns the actual, modeled temperature at the current altitude in degrees Rankine.
Encapsulates the JSBSim simulation executive.
Base class for all scheduled JSBSim models.