 |
JSBSim Flight Dynamics Model
1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
|
47 #include "input_output/string_utilities.h"
50 # define M_PI 3.14159265358979323846
61 BaseException(
const std::string& msg) : std::runtime_error(msg) {}
89 unsigned int messageId;
91 std::string subsystem;
92 enum mType {eText, eInteger, eDouble, eBool} type;
106 Filter(
double coeff,
double dt) {
107 prev_in = prev_out = 0.0;
108 double denom = 2.0 + coeff*dt;
110 cb = (2.0 - coeff*dt)/denom;
112 double execute(
double in) {
113 double out = (in + prev_in)*ca + prev_out*cb;
160 void PutMessage(
const std::string& text,
bool bVal);
165 void PutMessage(
const std::string& text,
int iVal);
170 void PutMessage(
const std::string& text,
double dVal);
185 static const std::string&
GetVersion(
void) {
return JSBSim_version;}
190 static short debug_lvl;
196 return 1.8*kelvin - 459.4;
203 return celsius * 1.8 + 491.67;
210 return (rankine - 491.67)/1.8;
231 return (fahrenheit - 32.0)/1.8;
238 return celsius * 1.8 + 32.0;
245 return celsius + 273.15;
252 return kelvin - 273.15;
259 return measure*0.3048;
302 double eps = 2.0*DBL_EPSILON;
303 return std::fabs(a - b) <= eps * std::max<double>(std::fabs(a), std::fabs(b));
311 float eps = 2.0*FLT_EPSILON;
312 return std::fabs(a - b) <= eps * std::max<double>(std::fabs(a), std::fabs(b));
333 static constexpr
double Constrain(
double min,
double value,
double max) {
334 return value<min?(min):(value>max?(max):(value));
337 static constexpr
double sign(
double num) {
return num>=0.0?1.0:-1.0;}
339 static double GaussianRandomNumber(
void);
342 static Message localMsg;
344 static std::queue <Message> Messages;
346 static unsigned int messageId;
348 static constexpr
double radtodeg = 180. / M_PI;
349 static constexpr
double degtorad = M_PI / 180.;
350 static constexpr
double hptoftlbssec = 550.0;
351 static constexpr
double psftoinhg = 0.014138;
352 static constexpr
double psftopa = 47.88;
353 static constexpr
double ktstofps = 1.68781;
354 static constexpr
double fpstokts = 1.0 / ktstofps;
355 static constexpr
double inchtoft = 1.0/12.0;
356 static constexpr
double fttom = 0.3048;
357 static constexpr
double m3toft3 = 1.0/(fttom*fttom*fttom);
358 static constexpr
double in3tom3 = inchtoft*inchtoft*inchtoft/m3toft3;
359 static constexpr
double inhgtopa = 3386.38;
367 static constexpr
double lbtoslug = 1.0/
slugtolb;
368 static constexpr
double kgtolb = 2.20462;
369 static constexpr
double kgtoslug = 0.06852168;
370 static const std::string needed_cfg_version;
371 static const std::string JSBSim_version;
373 static std::string CreateIndexedPropertyName(
const std::string& Property,
int index);
375 static int gaussian_random_number_phase;
379 enum {eL = 1, eM, eN };
381 enum {eP = 1, eQ, eR };
383 enum {eU = 1, eV, eW };
385 enum {eX = 1, eY, eZ };
387 enum {ePhi = 1, eTht, ePsi };
389 enum {eDrag = 1, eSide, eLift };
391 enum {eRoll = 1, ePitch, eYaw };
393 enum {eNorth = 1, eEast, eDown };
395 enum {eLat = 1, eLong, eRad };
397 enum {inNone = 0, inDegrees, inRadians, inMeters, inFeet };
static constexpr double CelsiusToRankine(double celsius)
Converts from degrees Celsius to degrees Rankine.
static constexpr double FahrenheitToCelsius(double fahrenheit)
Converts from degrees Fahrenheit to degrees Celsius.
static bool EqualToRoundoff(double a, double b)
Finite precision comparison.
static char fgdef[6]
default text
Message * ProcessNextMessage(void)
Reads the next message on the queue and removes it from the queue.
static double VcalibratedFromMach(double mach, double p)
Calculate the calibrated airspeed from the Mach number.
static double PitotTotalPressure(double mach, double p)
Compute the total pressure in front of the Pitot tube.
static bool EqualToRoundoff(float a, double b)
Finite precision comparison.
static constexpr double KelvinToRankine(double kelvin)
Converts from degrees Kelvin to degrees Rankine.
void PutMessage(const Message &msg)
Places a Message structure on the Message queue.
void ProcessMessage(void)
Reads the message on the queue and removes it from the queue.
static constexpr double KelvinToFahrenheit(double kelvin)
Converts from degrees Kelvin to degrees Fahrenheit.
static constexpr double CelsiusToKelvin(double celsius)
Converts from degrees Celsius to degrees Kelvin.
JSBSim Message structure.
static constexpr double slugtolb
Note that definition of lbtoslug by the inverse of slugtolb and not to a different constant you can a...
static const std::string & GetVersion(void)
Returns the version number of JSBSim.
static char halfint[5]
low intensity text
static double MachFromVcalibrated(double vcas, double p)
Calculate the Mach number from the calibrated airspeed.Based on the formulas in the US Air Force Airc...
static bool EqualToRoundoff(float a, float b)
Finite precision comparison.
static char fgred[6]
red text
FGJSBBase()
Constructor for FGJSBBase.
static char fggreen[6]
green text
static char reset[5]
resets text properties
static char fgcyan[6]
cyan text
static constexpr double RankineToCelsius(double rankine)
Converts from degrees Rankine to degrees Celsius.
static constexpr double Constrain(double min, double value, double max)
Constrain a value between a minimum and a maximum value.
static constexpr double CelsiusToFahrenheit(double celsius)
Converts from degrees Celsius to degrees Fahrenheit.
First order, (low pass / lag) filter.
virtual ~FGJSBBase()
Destructor for FGJSBBase.
static bool EqualToRoundoff(double a, float b)
Finite precision comparison.
static char underon[5]
underlines text
static char normint[6]
normal intensity text
static constexpr double FeetToMeters(double measure)
Converts from feet to meters.
static constexpr double RankineToKelvin(double rankine)
Converts from degrees Rankine to degrees Kelvin.
static char highint[5]
highlights text
static constexpr double KelvinToCelsius(double kelvin)
Converts from degrees Kelvin to degrees Celsius.
void disableHighLighting(void)
Disables highlighting in the console output.
static char fgblue[6]
blue text
static char underoff[6]
underline off
int SomeMessages(void) const
Reads the message on the queue (but does not delete it).
static double MachFromImpactPressure(double qc, double p)
Compute the Mach number from the differential pressure (qc) and the static pressure.