46 #include "input_output/string_utilities.h" 49 # define M_PI 3.14159265358979323846 51 #define IDENT(a,b) static const char* const (a)[] = {b,(a)[0]} 57 #define ID_JSBBASE "$Id: FGJSBBase.h,v 1.45 2016/01/10 12:07:49 bcoconni Exp $" 92 unsigned int messageId;
94 std::string subsystem;
95 enum mType {eText, eInteger, eDouble, eBool} type;
108 public:
Filter(
double coeff,
double dt) {
109 prev_in = prev_out = 0.0;
110 double denom = 2.0 + coeff*dt;
112 cb = (2.0 - coeff*dt)/denom;
114 public:
double execute(
double in) {
115 double out = (in + prev_in)*ca + prev_out*cb;
162 void PutMessage(
const std::string& text,
bool bVal);
167 void PutMessage(
const std::string& text,
int iVal);
172 void PutMessage(
const std::string& text,
double dVal);
192 static short debug_lvl;
198 return 1.8*kelvin - 459.4;
205 return celsius * 1.8 + 491.67;
212 return (rankine - 491.67)/1.8;
233 return (fahrenheit - 32.0)/1.8;
240 return celsius * 1.8 + 32.0;
247 return celsius + 273.15;
254 return kelvin - 273.15;
261 return measure*0.3048;
301 double eps = 2.0*DBL_EPSILON;
302 return std::fabs(a - b) <= eps * std::max<double>(std::fabs(a), std::fabs(b));
310 float eps = 2.0*FLT_EPSILON;
311 return std::fabs(a - b) <= eps * std::max<double>(std::fabs(a), std::fabs(b));
332 static double Constrain(
double min,
double value,
double max) {
333 return value<min?(min):(value>max?(max):(value));
336 static double sign(
double num) {
return num>=0.0?1.0:-1.0;}
338 static double GaussianRandomNumber(
void);
343 static std::queue <Message> Messages;
347 static unsigned int messageId;
349 static const double radtodeg;
350 static const double degtorad;
351 static const double hptoftlbssec;
352 static const double psftoinhg;
353 static const double psftopa;
354 static const double fpstokts;
355 static const double ktstofps;
356 static const double inchtoft;
357 static const double in3tom3;
358 static const double m3toft3;
359 static const double inhgtopa;
360 static const double fttom;
364 static const double SHRatio;
365 static const double lbtoslug;
366 static const double slugtolb;
367 static const double kgtolb;
368 static const double kgtoslug;
369 static const std::string needed_cfg_version;
370 static const std::string JSBSim_version;
372 static std::string CreateIndexedPropertyName(
const std::string& Property,
int index);
374 static int gaussian_random_number_phase;
378 enum {eL = 1, eM, eN };
380 enum {eP = 1, eQ, eR };
382 enum {eU = 1, eV, eW };
384 enum {eX = 1, eY, eZ };
386 enum {ePhi = 1, eTht, ePsi };
388 enum {eDrag = 1, eSide, eLift };
390 enum {eRoll = 1, ePitch, eYaw };
392 enum {eNorth = 1, eEast, eDown };
394 enum {eLat = 1, eLong, eRad };
396 enum {inNone = 0, inDegrees, inRadians, inMeters, inFeet };
virtual ~FGJSBBase()
Destructor for FGJSBBase.
static char fgcyan[6]
cyan text
static bool EqualToRoundoff(float a, float b)
Finite precision comparison.
static double Constrain(double min, double value, double max)
Constrain a value between a minimum and a maximum value.
int SomeMessages(void)
Reads the message on the queue (but does not delete it).
static double KelvinToFahrenheit(double kelvin)
Converts from degrees Kelvin to degrees Fahrenheit.
static double CelsiusToFahrenheit(double celsius)
Converts from degrees Celsius to degrees Fahrenheit.
static double RankineToCelsius(double rankine)
Converts from degrees Rankine to degrees Celsius.
FGJSBBase()
Constructor for FGJSBBase.
static char halfint[5]
low intensity text
static char reset[5]
resets text properties
std::string GetVersion(void)
Returns the version number of JSBSim.
void disableHighLighting(void)
Disables highlighting in the console output.
static char normint[6]
normal intensity text
void PutMessage(const Message &msg)
Places a Message structure on the Message queue.
static double PitotTotalPressure(double mach, double p)
Compute the total pressure in front of the Pitot tube.
static char fgred[6]
red text
static double VcalibratedFromMach(double mach, double p, double psl, double rhosl)
Calculate the calibrated airspeed from the Mach number.
static double CelsiusToRankine(double celsius)
Converts from degrees Celsius to degrees Rankine.
First order, (low pass / lag) filter.
static double MachFromVcalibrated(double vcas, double p, double psl, double rhosl)
Calculate the Mach number from the calibrated airspeed.
static char fgdef[6]
default text
void ProcessMessage(void)
Reads the message on the queue and removes it from the queue.
static bool EqualToRoundoff(double a, float b)
Finite precision comparison.
static double RankineToKelvin(double rankine)
Converts from degrees Rankine to degrees Kelvin.
static char fggreen[6]
green text
static char underoff[6]
underline off
static bool EqualToRoundoff(double a, double b)
Finite precision comparison.
static char fgblue[6]
blue text
static double CelsiusToKelvin(double celsius)
Converts from degrees Celsius to degrees Kelvin.
JSBSim Message structure.
static double FeetToMeters(double measure)
Converts from feet to meters.
static char highint[5]
highlights text
static bool EqualToRoundoff(float a, double b)
Finite precision comparison.
static double FahrenheitToCelsius(double fahrenheit)
Converts from degrees Fahrenheit to degrees Celsius.
static double KelvinToRankine(double kelvin)
Converts from degrees Kelvin to degrees Rankine.
static char underon[5]
underlines text
static double KelvinToCelsius(double kelvin)
Converts from degrees Kelvin to degrees Celsius.
Message * ProcessNextMessage(void)
Reads the next message on the queue and removes it from the queue.