1
0
Fork 0

YASIM move constants to a common header file.

This commit is contained in:
Henning Stahlke 2017-04-28 20:23:48 +02:00
parent 0a0402f667
commit efde524685
6 changed files with 37 additions and 57 deletions

View file

@ -27,25 +27,6 @@
namespace yasim { namespace yasim {
// Some conversion factors
static const float KTS2MPS = 0.514444444444;
static const float KMH2MPS = 1/3.6;
static const float FT2M = 0.3048;
static const float DEG2RAD = 0.0174532925199;
static const float RPM2RAD = 0.10471975512;
static const float LBS2N = 4.44822;
static const float LBS2KG = 0.45359237;
static const float KG2LBS = 2.2046225;
static const float CM2GALS = 264.172037284;
static const float HP2W = 745.700;
static const float INHG2PA = 3386.389;
static const float K2DEGF = 1.8;
static const float K2DEGFOFFSET = -459.4;
static const float CIN2CM = 1.6387064e-5;
static const float YASIM_PI = 3.14159265358979323846;
static const float NM2FTLB = (1/(LBS2N*FT2M));
// Stubs, so that this can be compiled without the FlightGear // Stubs, so that this can be compiled without the FlightGear
// binary. What's the best way to handle this? // binary. What's the best way to handle this?

View file

@ -4,6 +4,7 @@
#include <simgear/xml/easyxml.hxx> #include <simgear/xml/easyxml.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
#include "yasim-common.hpp"
#include "Airplane.hpp" #include "Airplane.hpp"
#include "Vector.hpp" #include "Vector.hpp"

View file

@ -15,6 +15,7 @@
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
#include "yasim-common.hpp"
#include "FGFDM.hpp" #include "FGFDM.hpp"
#include "Atmosphere.hpp" #include "Atmosphere.hpp"
#include "Math.hpp" #include "Math.hpp"
@ -34,22 +35,6 @@
using namespace yasim; using namespace yasim;
using std::string; using std::string;
static const float YASIM_PI = 3.14159265358979323846;
static const float RAD2DEG = 180/YASIM_PI;
static const float PI2 = YASIM_PI*2;
static const float M2FT = 3.2808399;
static const float FT2M = 0.3048;
static const float MPS2KTS = 3600.0/1852.0;
static const float INHG2PA = 3386.389;
static const float SLUG2KG = 14.59390;
#if 0 // unused constant values
static const float RAD2RPM = 9.54929658551;
static const float CM2GALS = 264.172037284; // gallons/cubic meter
static const float KG2LBS = 2.20462262185;
static const float W2HP = 1.3416e-3;
#endif
YASim::YASim(double dt) : YASim::YASim(double dt) :
_simTime(0) _simTime(0)
{ {

View file

@ -29,23 +29,6 @@ float fgGetFloat (const char * name, float defaultValue) { return 0; }
double fgGetDouble (const char * name, double defaultValue) { return 0; } double fgGetDouble (const char * name, double defaultValue) { return 0; }
bool fgSetDouble (const char * name, double defaultValue) { return false; } bool fgSetDouble (const char * name, double defaultValue) { return false; }
static const float KTS2MPS = 0.514444444444;
static const float RPM2RAD = 0.10471975512;
static const float HP2W = 745.700;
static const float FT2M = 0.3048;
static const float N2LB = 0.224809;
// static const float DEG2RAD = 0.0174532925199;
// static const float LBS2N = 4.44822;
// static const float LBS2KG = 0.45359237;
// static const float KG2LBS = 2.2046225;
// static const float CM2GALS = 264.172037284;
// static const float INHG2PA = 3386.389;
// static const float K2DEGF = 1.8;
// static const float K2DEGFOFFSET = -459.4;
// static const float CIN2CM = 1.6387064e-5;
// static const float YASIM_PI = 3.14159265358979323846;
const int COUNT = 100; const int COUNT = 100;
int main(int argc, char** argv) int main(int argc, char** argv)

View file

@ -0,0 +1,34 @@
#ifndef _YASIM_COMMON_HPP
#define _YASIM_COMMON_HPP
namespace yasim {
static const float YASIM_PI = 3.14159265358979323846;
static const float PI2 = YASIM_PI*2;
static const float RAD2DEG = 180/YASIM_PI;
static const float DEG2RAD = YASIM_PI/180;
static const float RPM2RAD = YASIM_PI/30;
static const float KTS2MPS = 1852.0/3600.0;
static const float MPS2KTS = 3600.0/1852.0;
static const float KMH2MPS = 1/3.6;
static const float FT2M = 0.3048;
static const float M2FT = 1/FT2M;
static const float LBS2N = 4.44822;
static const float N2LB = 1/LBS2N;
static const float LBS2KG = 0.45359237;
static const float KG2LBS = 1/LBS2KG;
static const float CM2GALS = 264.172037284;
static const float HP2W = 745.700;
static const float INHG2PA = 3386.389;
static const float K2DEGF = 1.8;
static const float K2DEGFOFFSET = -459.4;
static const float CIN2CM = 1.6387064e-5;
static const float NM2FTLB = (1/(LBS2N*FT2M));
static const float SLUG2KG = 14.59390;
};
#endif // ifndef _YASIM_COMMON_HPP

View file

@ -7,6 +7,7 @@
#include <simgear/xml/easyxml.hxx> #include <simgear/xml/easyxml.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include "yasim-common.hpp"
#include "FGFDM.hpp" #include "FGFDM.hpp"
#include "Atmosphere.hpp" #include "Atmosphere.hpp"
#include "RigidBody.hpp" #include "RigidBody.hpp"
@ -26,11 +27,6 @@ float fgGetFloat (const char * name, float defaultValue) { return 0; }
double fgGetDouble (const char * name, double defaultValue = 0.0) { return 0; } double fgGetDouble (const char * name, double defaultValue = 0.0) { return 0; }
bool fgSetDouble (const char * name, double defaultValue = 0.0) { return 0; } bool fgSetDouble (const char * name, double defaultValue = 0.0) { return 0; }
static const float RAD2DEG = 57.2957795131;
static const float DEG2RAD = 0.0174532925199;
/// knots 2 meters per second
static const float KTS2MPS = 0.514444444444;
enum Config enum Config
{ {