Synced with latest JSBSim cvs.
This commit is contained in:
parent
3d1e802b84
commit
d19ef5cd99
86 changed files with 1436 additions and 1361 deletions
|
@ -259,6 +259,28 @@ bool FGJSBsim::update( int multiloop ) {
|
|||
fdmex->Run();
|
||||
}
|
||||
|
||||
struct FGJSBBase::Message* msg;
|
||||
while (fdmex->ReadMessage()) {
|
||||
msg = fdmex->ProcessMessage();
|
||||
switch (msg->type) {
|
||||
case FGJSBBase::Message::eText:
|
||||
cout << msg->messageId << ": " << msg->text << endl;
|
||||
break;
|
||||
case FGJSBBase::Message::eBool:
|
||||
cout << msg->messageId << ": " << msg->text << " " << msg->bVal << endl;
|
||||
break;
|
||||
case FGJSBBase::Message::eInteger:
|
||||
cout << msg->messageId << ": " << msg->text << " " << msg->iVal << endl;
|
||||
break;
|
||||
case FGJSBBase::Message::eDouble:
|
||||
cout << msg->messageId << ": " << msg->text << " " << msg->dVal << endl;
|
||||
break;
|
||||
default:
|
||||
cerr << "Unrecognized message type." << endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for( i=0; i<get_num_engines(); i++ ) {
|
||||
FGEngInterface * e = get_engine(i);
|
||||
FGEngine * eng = Propulsion->GetEngine(i);
|
||||
|
|
|
@ -88,14 +88,10 @@ FGAerodynamics::~FGAerodynamics()
|
|||
|
||||
bool FGAerodynamics::Run(void)
|
||||
{
|
||||
float alpha, beta;
|
||||
unsigned int axis_ctr,ctr;
|
||||
|
||||
if (!FGModel::Run()) {
|
||||
|
||||
alpha = Translation->Getalpha();
|
||||
beta = Translation->Getbeta();
|
||||
|
||||
vLastFs = vFs;
|
||||
vFs.InitMatrix();
|
||||
|
||||
|
@ -105,7 +101,7 @@ bool FGAerodynamics::Run(void)
|
|||
}
|
||||
}
|
||||
|
||||
vForces = State->GetTs2b(alpha, beta)*vFs;
|
||||
vForces = State->GetTs2b()*vFs;
|
||||
|
||||
vDXYZcg(eX) = -(Aircraft->GetXYZrp(eX)
|
||||
- MassBalance->GetXYZcg(eX))*inchtoft;
|
||||
|
@ -135,12 +131,12 @@ bool FGAerodynamics::Load(FGConfigFile* AC_cfg)
|
|||
|
||||
AC_cfg->GetNextConfigLine();
|
||||
|
||||
while ((token = AC_cfg->GetValue()) != "/AERODYNAMICS") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/AERODYNAMICS")) {
|
||||
if (token == "AXIS") {
|
||||
CoeffArray ca;
|
||||
axis = AC_cfg->GetValue("NAME");
|
||||
AC_cfg->GetNextConfigLine();
|
||||
while ((token = AC_cfg->GetValue()) != "/AXIS") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/AXIS")) {
|
||||
if( token == "COEFFICIENT" ) {
|
||||
ca.push_back( new FGCoefficient(FDMExec) );
|
||||
ca.back()->Load(AC_cfg);
|
||||
|
@ -202,7 +198,7 @@ string FGAerodynamics::GetCoefficientValues(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGAerodynamics::GetNlf(void)
|
||||
double FGAerodynamics::GetNlf(void)
|
||||
{
|
||||
if (fabs(Position->GetGamma()) < 1.57) {
|
||||
return (vFs(eZ)/(MassBalance->GetWeight()*cos(Position->GetGamma())));
|
||||
|
@ -213,9 +209,9 @@ float FGAerodynamics::GetNlf(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGAerodynamics::GetLoD(void)
|
||||
double FGAerodynamics::GetLoD(void)
|
||||
{
|
||||
float LoD;
|
||||
double LoD;
|
||||
|
||||
if (vFs(1) != 0.00) return vFs(3)/vFs(1);
|
||||
else return 0.00;
|
||||
|
|
|
@ -112,18 +112,18 @@ public:
|
|||
/** Gets the total aerodynamic force vector.
|
||||
@return a force vector reference. */
|
||||
FGColumnVector3& GetForces(void) {return vForces;}
|
||||
inline float GetForces(int n) {return vForces(n);}
|
||||
inline double GetForces(int n) {return vForces(n);}
|
||||
|
||||
/** Gets the total aerodynamic moment vector.
|
||||
@return a moment vector reference. */
|
||||
FGColumnVector3& GetMoments(void) {return vMoments;}
|
||||
inline float GetMoments(int n) {return vMoments(n);}
|
||||
inline double GetMoments(int n) {return vMoments(n);}
|
||||
|
||||
inline FGColumnVector3& GetvLastFs(void) { return vLastFs; }
|
||||
inline float GetvLastFs(int axis) { return vLastFs(axis); }
|
||||
inline double GetvLastFs(int axis) { return vLastFs(axis); }
|
||||
inline FGColumnVector3& GetvFs(void) { return vFs; }
|
||||
inline float GetvFs(int axis) { return vFs(axis); }
|
||||
float GetLoD(void);
|
||||
inline double GetvFs(int axis) { return vFs(axis); }
|
||||
double GetLoD(void);
|
||||
|
||||
/** Gets the strings for the current set of coefficients.
|
||||
@return a string containing the descriptive names for all coefficients */
|
||||
|
@ -135,7 +135,7 @@ public:
|
|||
string GetCoefficientValues(void);
|
||||
|
||||
/// Gets the Normal Load Factor
|
||||
float GetNlf(void);
|
||||
double GetNlf(void);
|
||||
|
||||
private:
|
||||
typedef map<string,int> AxisIndex;
|
||||
|
|
|
@ -134,8 +134,8 @@ bool FGAircraft::Load(FGConfigFile* AC_cfg)
|
|||
|
||||
ReadPrologue(AC_cfg);
|
||||
|
||||
while ((AC_cfg->GetNextConfigLine() != "EOF") &&
|
||||
(token = AC_cfg->GetValue()) != "/FDM_CONFIG") {
|
||||
while ((AC_cfg->GetNextConfigLine() != string("EOF")) &&
|
||||
(token = AC_cfg->GetValue()) != string("/FDM_CONFIG")) {
|
||||
if (token == "METRICS") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
|
||||
ReadMetrics(AC_cfg);
|
||||
|
@ -196,16 +196,40 @@ bool FGAircraft::Run(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAircraft::ReadPrologue(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token = AC_cfg->GetValue();
|
||||
string scratch;
|
||||
AircraftName = AC_cfg->GetValue("NAME");
|
||||
if (debug_lvl > 0) cout << underon << "Reading Aircraft Configuration File"
|
||||
<< underoff << ": " << highint << AircraftName << normint << endl;
|
||||
scratch = AC_cfg->GetValue("VERSION").c_str();
|
||||
|
||||
CFGVersion = AC_cfg->GetValue("VERSION");
|
||||
|
||||
if (debug_lvl > 0)
|
||||
cout << " Version: " << highint << CFGVersion
|
||||
<< normint << endl;
|
||||
if (CFGVersion != needed_cfg_version) {
|
||||
cerr << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
|
||||
" RESULTS WILL BE UNPREDICTABLE !!" << endl;
|
||||
cerr << "Current version needed is: " << needed_cfg_version << endl;
|
||||
cerr << " You have version: " << CFGVersion << endl << fgdef << endl;
|
||||
}
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token = "";
|
||||
string parameter;
|
||||
float EW, bixx, biyy, bizz, bixz, biyz;
|
||||
double EW, bixx, biyy, bizz, bixz, biyz;
|
||||
FGColumnVector3 vbaseXYZcg(3);
|
||||
|
||||
AC_cfg->GetNextConfigLine();
|
||||
|
||||
while ((token = AC_cfg->GetValue()) != "/METRICS") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/METRICS")) {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "AC_WINGAREA") {
|
||||
*AC_cfg >> WingArea;
|
||||
|
@ -325,100 +349,8 @@ void FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg)
|
|||
|
||||
void FGAircraft::ReadOutput(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token, parameter;
|
||||
int OutRate = 0;
|
||||
int subsystems = 0;
|
||||
|
||||
token = AC_cfg->GetValue("NAME");
|
||||
Output->SetFilename(token);
|
||||
token = AC_cfg->GetValue("TYPE");
|
||||
Output->SetType(token);
|
||||
AC_cfg->GetNextConfigLine();
|
||||
|
||||
while ((token = AC_cfg->GetValue()) != "/OUTPUT") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate;
|
||||
if (parameter == "SIMULATION") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssSimulation;
|
||||
}
|
||||
if (parameter == "AEROSURFACES") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssAerosurfaces;
|
||||
}
|
||||
if (parameter == "RATES") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssRates;
|
||||
}
|
||||
if (parameter == "VELOCITIES") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssVelocities;
|
||||
}
|
||||
if (parameter == "FORCES") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssForces;
|
||||
}
|
||||
if (parameter == "MOMENTS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssMoments;
|
||||
}
|
||||
if (parameter == "ATMOSPHERE") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssAtmosphere;
|
||||
}
|
||||
if (parameter == "MASSPROPS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssMassProps;
|
||||
}
|
||||
if (parameter == "POSITION") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssPosition;
|
||||
}
|
||||
if (parameter == "COEFFICIENTS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssCoefficients;
|
||||
}
|
||||
if (parameter == "GROUND_REACTIONS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssGroundReactions;
|
||||
}
|
||||
if (parameter == "FCS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssFCS;
|
||||
}
|
||||
if (parameter == "PROPULSION") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") subsystems += ssPropulsion;
|
||||
}
|
||||
}
|
||||
|
||||
Output->SetSubsystems(subsystems);
|
||||
|
||||
OutRate = OutRate>120?120:(OutRate<0?0:OutRate);
|
||||
Output->SetRate( (int)(0.5 + 1.0/(State->Getdt()*OutRate)) );
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAircraft::ReadPrologue(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token = AC_cfg->GetValue();
|
||||
string scratch;
|
||||
AircraftName = AC_cfg->GetValue("NAME");
|
||||
if (debug_lvl > 0) cout << underon << "Reading Aircraft Configuration File"
|
||||
<< underoff << ": " << highint << AircraftName << normint << endl;
|
||||
scratch = AC_cfg->GetValue("VERSION").c_str();
|
||||
|
||||
CFGVersion = AC_cfg->GetValue("VERSION");
|
||||
|
||||
if (debug_lvl > 0)
|
||||
cout << " Version: " << highint << CFGVersion
|
||||
<< normint << endl;
|
||||
if (CFGVersion != needed_cfg_version) {
|
||||
cerr << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
|
||||
" RESULTS WILL BE UNPREDICTABLE !!" << endl;
|
||||
cerr << "Current version needed is: " << needed_cfg_version << endl;
|
||||
cerr << " You have version: " << CFGVersion << endl << fgdef << endl;
|
||||
if (!Output->Load(AC_cfg)) {
|
||||
cerr << "Output not successfully loaded" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -172,53 +172,36 @@ public:
|
|||
inline string GetAircraftName(void) { return AircraftName; }
|
||||
|
||||
/// Gets the wing area
|
||||
inline float GetWingArea(void) { return WingArea; }
|
||||
inline double GetWingArea(void) { return WingArea; }
|
||||
/// Gets the wing span
|
||||
inline float GetWingSpan(void) { return WingSpan; }
|
||||
inline double GetWingSpan(void) { return WingSpan; }
|
||||
/// Gets the average wing chord
|
||||
inline float Getcbar(void) { return cbar; }
|
||||
inline float GetWingIncidence(void) { return WingIncidence; }
|
||||
inline float GetHTailArea(void) { return HTailArea; }
|
||||
inline float GetHTailArm(void) { return HTailArm; }
|
||||
inline float GetVTailArea(void) { return VTailArea; }
|
||||
inline float GetVTailArm(void) { return VTailArm; }
|
||||
inline float Getlbarh(void) { return lbarh; } // HTailArm / cbar
|
||||
inline float Getlbarv(void) { return lbarv; } // VTailArm / cbar
|
||||
inline float Getvbarh(void) { return vbarh; } // H. Tail Volume
|
||||
inline float Getvbarv(void) { return vbarv; } // V. Tail Volume
|
||||
inline double Getcbar(void) { return cbar; }
|
||||
inline double GetWingIncidence(void) { return WingIncidence; }
|
||||
inline double GetHTailArea(void) { return HTailArea; }
|
||||
inline double GetHTailArm(void) { return HTailArm; }
|
||||
inline double GetVTailArea(void) { return VTailArea; }
|
||||
inline double GetVTailArm(void) { return VTailArm; }
|
||||
inline double Getlbarh(void) { return lbarh; } // HTailArm / cbar
|
||||
inline double Getlbarv(void) { return lbarv; } // VTailArm / cbar
|
||||
inline double Getvbarh(void) { return vbarh; } // H. Tail Volume
|
||||
inline double Getvbarv(void) { return vbarv; } // V. Tail Volume
|
||||
inline FGColumnVector3& GetMoments(void) { return vMoments; }
|
||||
inline FGColumnVector3& GetForces(void) { return vForces; }
|
||||
inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
|
||||
inline FGColumnVector3& GetNcg (void) { return vNcg; }
|
||||
inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
|
||||
inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
|
||||
inline float GetXYZrp(int idx) { return vXYZrp(idx); }
|
||||
inline float GetXYZep(int idx) { return vXYZep(idx); }
|
||||
inline float GetAlphaCLMax(void) { return alphaclmax; }
|
||||
inline float GetAlphaCLMin(void) { return alphaclmin; }
|
||||
inline double GetXYZrp(int idx) { return vXYZrp(idx); }
|
||||
inline double GetXYZep(int idx) { return vXYZep(idx); }
|
||||
inline double GetAlphaCLMax(void) { return alphaclmax; }
|
||||
inline double GetAlphaCLMin(void) { return alphaclmin; }
|
||||
|
||||
inline void SetAlphaCLMax(float tt) { alphaclmax=tt; }
|
||||
inline void SetAlphaCLMin(float tt) { alphaclmin=tt; }
|
||||
inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
|
||||
inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
|
||||
|
||||
inline bool GetStallWarn(void) { return impending_stall; }
|
||||
|
||||
/// Subsystem types for specifying which will be output in the FDM data logging
|
||||
enum SubSystems {
|
||||
/** Subsystem: Simulation (= 1) */ ssSimulation = 1,
|
||||
/** Subsystem: Aerosurfaces (= 2) */ ssAerosurfaces = 2,
|
||||
/** Subsystem: Body rates (= 4) */ ssRates = 4,
|
||||
/** Subsystem: Velocities (= 8) */ ssVelocities = 8,
|
||||
/** Subsystem: Forces (= 16) */ ssForces = 16,
|
||||
/** Subsystem: Moments (= 32) */ ssMoments = 32,
|
||||
/** Subsystem: Atmosphere (= 64) */ ssAtmosphere = 64,
|
||||
/** Subsystem: Mass Properties (= 128) */ ssMassProps = 128,
|
||||
/** Subsystem: Coefficients (= 256) */ ssCoefficients = 256,
|
||||
/** Subsystem: Position (= 512) */ ssPosition = 512,
|
||||
/** Subsystem: Ground Reactions (= 1024) */ ssGroundReactions = 1024,
|
||||
/** Subsystem: FCS (= 2048) */ ssFCS = 2048,
|
||||
/** Subsystem: Propulsion (= 4096) */ ssPropulsion = 4096
|
||||
} subsystems;
|
||||
|
||||
private:
|
||||
FGColumnVector3 vMoments;
|
||||
FGColumnVector3 vForces;
|
||||
|
@ -229,11 +212,11 @@ private:
|
|||
FGColumnVector3 vBodyAccel;
|
||||
FGColumnVector3 vNcg;
|
||||
|
||||
float WingArea, WingSpan, cbar, WingIncidence;
|
||||
float HTailArea, VTailArea, HTailArm, VTailArm;
|
||||
float lbarh,lbarv,vbarh,vbarv;
|
||||
float alphaclmax,alphaclmin;
|
||||
float impending_stall;
|
||||
double WingArea, WingSpan, cbar, WingIncidence;
|
||||
double HTailArea, VTailArea, HTailArm, VTailArm;
|
||||
double lbarh,lbarv,vbarh,vbarv;
|
||||
double alphaclmax,alphaclmin;
|
||||
double impending_stall;
|
||||
string CFGVersion;
|
||||
string AircraftName;
|
||||
|
||||
|
|
|
@ -135,19 +135,19 @@ bool FGAtmosphere::Run(void)
|
|||
soundspeed = sqrt(SHRatio*Reng*temperature);
|
||||
|
||||
State->Seta(soundspeed);
|
||||
|
||||
} else { // skip Run() execution this time
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAtmosphere::Calculate(float altitude)
|
||||
void FGAtmosphere::Calculate(double altitude)
|
||||
{
|
||||
//see reference [1]
|
||||
|
||||
float slope,reftemp,refpress;
|
||||
double slope,reftemp,refpress;
|
||||
int i=0; bool lookup = false;
|
||||
// cout << "Atmosphere: h=" << altitude << " rho= " << density << endl;
|
||||
i=lastIndex;
|
||||
|
|
|
@ -91,32 +91,32 @@ public:
|
|||
bool InitModel(void);
|
||||
|
||||
/// Returns the temperature in degrees Rankine.
|
||||
inline float GetTemperature(void) {return temperature;}
|
||||
inline double GetTemperature(void) {return temperature;}
|
||||
/** Returns the density in slugs/ft^3.
|
||||
<i>This function may <b>only</b> be used if Run() is called first.</i> */
|
||||
inline float GetDensity(void) {return density;}
|
||||
inline double GetDensity(void) {return density;}
|
||||
/// Returns the pressure in psf.
|
||||
inline float GetPressure(void) {return pressure;}
|
||||
inline double GetPressure(void) {return pressure;}
|
||||
/// Returns the speed of sound in ft/sec.
|
||||
inline float GetSoundSpeed(void) {return soundspeed;}
|
||||
inline double GetSoundSpeed(void) {return soundspeed;}
|
||||
|
||||
/// Returns the sea level temperature in degrees Rankine.
|
||||
inline float GetTemperatureSL(void) { return SLtemperature; }
|
||||
inline double GetTemperatureSL(void) { return SLtemperature; }
|
||||
/// Returns the sea level density in slugs/ft^3
|
||||
inline float GetDensitySL(void) { return SLdensity; }
|
||||
inline double GetDensitySL(void) { return SLdensity; }
|
||||
/// Returns the sea level pressure in psf.
|
||||
inline float GetPressureSL(void) { return SLpressure; }
|
||||
inline double GetPressureSL(void) { return SLpressure; }
|
||||
/// Returns the sea level speed of sound in ft/sec.
|
||||
inline float GetSoundSpeedSL(void) { return SLsoundspeed; }
|
||||
inline double GetSoundSpeedSL(void) { return SLsoundspeed; }
|
||||
|
||||
/// Returns the ratio of at-altitude temperature over the sea level value.
|
||||
inline float GetTemperatureRatio(void) { return temperature*rSLtemperature; }
|
||||
inline double GetTemperatureRatio(void) { return temperature*rSLtemperature; }
|
||||
/// Returns the ratio of at-altitude density over the sea level value.
|
||||
inline float GetDensityRatio(void) { return density*rSLdensity; }
|
||||
inline double GetDensityRatio(void) { return density*rSLdensity; }
|
||||
/// Returns the ratio of at-altitude pressure over the sea level value.
|
||||
inline float GetPressureRatio(void) { return pressure*rSLpressure; }
|
||||
inline double GetPressureRatio(void) { return pressure*rSLpressure; }
|
||||
/// Returns the ratio of at-altitude sound speed over the sea level value.
|
||||
inline float GetSoundSpeedRatio(void) { return soundspeed*rSLsoundspeed; }
|
||||
inline double GetSoundSpeedRatio(void) { return soundspeed*rSLsoundspeed; }
|
||||
|
||||
/// Tells the simulator to use an externally calculated atmosphere model.
|
||||
inline void UseExternal(void) { useExternal=true; }
|
||||
|
@ -126,21 +126,21 @@ public:
|
|||
bool External(void) { return useExternal; }
|
||||
|
||||
/// Provides the external atmosphere model with an interface to set the temperature.
|
||||
inline void SetExTemperature(float t) { exTemperature=t; }
|
||||
inline void SetExTemperature(double t) { exTemperature=t; }
|
||||
/// Provides the external atmosphere model with an interface to set the density.
|
||||
inline void SetExDensity(float d) { exDensity=d; }
|
||||
inline void SetExDensity(double d) { exDensity=d; }
|
||||
/// Provides the external atmosphere model with an interface to set the pressure.
|
||||
inline void SetExPressure(float p) { exPressure=p; }
|
||||
inline void SetExPressure(double p) { exPressure=p; }
|
||||
|
||||
/// Sets the wind components in NED frame.
|
||||
inline void SetWindNED(float wN, float wE, float wD) { vWindNED(1)=wN; vWindNED(2)=wE; vWindNED(3)=wD;}
|
||||
inline void SetWindNED(double wN, double wE, double wD) { vWindNED(1)=wN; vWindNED(2)=wE; vWindNED(3)=wD;}
|
||||
|
||||
/// Retrieves the wind components in NED frame.
|
||||
inline FGColumnVector3& GetWindNED(void) { return vWindNED; }
|
||||
|
||||
/** Retrieves the wind direction. The direction is defined as north=0 and
|
||||
increases counterclockwise. The wind heading is returned in radians.*/
|
||||
inline float GetWindPsi(void) { return psiw; }
|
||||
inline double GetWindPsi(void) { return psiw; }
|
||||
|
||||
private:
|
||||
double rho;
|
||||
|
@ -157,7 +157,7 @@ private:
|
|||
FGColumnVector3 vWindNED;
|
||||
double psiw;
|
||||
|
||||
void Calculate(float altitude);
|
||||
void Calculate(double altitude);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ FGAuxiliary::~FGAuxiliary()
|
|||
|
||||
bool FGAuxiliary::Run()
|
||||
{
|
||||
float A,B,D;
|
||||
double A,B,D;
|
||||
|
||||
if (!FGModel::Run()) {
|
||||
GetState();
|
||||
|
@ -164,9 +164,9 @@ bool FGAuxiliary::Run()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGAuxiliary::GetHeadWind(void)
|
||||
double FGAuxiliary::GetHeadWind(void)
|
||||
{
|
||||
float psiw,vw,psi;
|
||||
double psiw,vw,psi;
|
||||
|
||||
psiw = Atmosphere->GetWindPsi();
|
||||
psi = Rotation->Getpsi();
|
||||
|
@ -177,9 +177,9 @@ float FGAuxiliary::GetHeadWind(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGAuxiliary::GetCrossWind(void)
|
||||
double FGAuxiliary::GetCrossWind(void)
|
||||
{
|
||||
float psiw,vw,psi;
|
||||
double psiw,vw,psi;
|
||||
|
||||
psiw = Atmosphere->GetWindPsi();
|
||||
psi = Rotation->Getpsi();
|
||||
|
@ -197,7 +197,7 @@ FGColumnVector3 FGAuxiliary::GetNpilot(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGAuxiliary::GetNpilot(int idx)
|
||||
double FGAuxiliary::GetNpilot(int idx)
|
||||
{
|
||||
return (vPilotAccel/Inertial->gravity())(idx);
|
||||
}
|
||||
|
|
|
@ -85,26 +85,26 @@ public:
|
|||
bool Run(void);
|
||||
|
||||
// Use FGInitialCondition to set these speeds
|
||||
inline float GetVcalibratedFPS(void) { return vcas; }
|
||||
inline float GetVcalibratedKTS(void) { return vcas*fpstokts; }
|
||||
inline float GetVequivalentFPS(void) { return veas; }
|
||||
inline float GetVequivalentKTS(void) { return veas*fpstokts; }
|
||||
inline double GetVcalibratedFPS(void) { return vcas; }
|
||||
inline double GetVcalibratedKTS(void) { return vcas*fpstokts; }
|
||||
inline double GetVequivalentFPS(void) { return veas; }
|
||||
inline double GetVequivalentKTS(void) { return veas*fpstokts; }
|
||||
|
||||
inline FGColumnVector3& GetPilotAccel(void) { return vPilotAccel; }
|
||||
inline float GetPilotAccel(int idx) { return vPilotAccel(idx); }
|
||||
inline double GetPilotAccel(int idx) { return vPilotAccel(idx); }
|
||||
FGColumnVector3 GetNpilot(void);
|
||||
float GetNpilot(int idx);
|
||||
double GetNpilot(int idx);
|
||||
|
||||
inline float GetEarthPositionAngle(void) { return earthPosAngle; }
|
||||
inline double GetEarthPositionAngle(void) { return earthPosAngle; }
|
||||
|
||||
float GetHeadWind(void);
|
||||
float GetCrossWind(void);
|
||||
double GetHeadWind(void);
|
||||
double GetCrossWind(void);
|
||||
|
||||
private:
|
||||
float vcas;
|
||||
float veas;
|
||||
float mach;
|
||||
float qbar,rhosl,rho,p,psl,pt;
|
||||
double vcas;
|
||||
double veas;
|
||||
double mach;
|
||||
double qbar,rhosl,rho,p,psl,pt;
|
||||
|
||||
// Don't add a getter for pt!
|
||||
// pt above is freestream total pressure for subsonic only
|
||||
|
@ -116,7 +116,7 @@ private:
|
|||
FGColumnVector3 vPilotAccel;
|
||||
FGColumnVector3 vToEyePt;
|
||||
|
||||
float earthPosAngle;
|
||||
double earthPosAngle;
|
||||
|
||||
void GetState(void);
|
||||
void Debug(void);
|
||||
|
|
|
@ -140,7 +140,7 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
|
|||
n = multparms.find("|");
|
||||
start = 0;
|
||||
|
||||
if(multparms != "FG_NONE") {
|
||||
if (multparms != string("FG_NONE")) {
|
||||
while (n < end && n >= 0) {
|
||||
n -= start;
|
||||
mult = multparms.substr(start,n);
|
||||
|
@ -179,9 +179,9 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGCoefficient::Value(float rVal, float cVal)
|
||||
double FGCoefficient::Value(double rVal, double cVal)
|
||||
{
|
||||
float Value;
|
||||
double Value;
|
||||
unsigned int midx;
|
||||
|
||||
SD = Value = Table->GetValue(rVal, cVal);
|
||||
|
@ -194,9 +194,9 @@ float FGCoefficient::Value(float rVal, float cVal)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGCoefficient::Value(float Val)
|
||||
double FGCoefficient::Value(double Val)
|
||||
{
|
||||
float Value;
|
||||
double Value;
|
||||
|
||||
SD = Value = Table->GetValue(Val);
|
||||
|
||||
|
@ -208,9 +208,9 @@ float FGCoefficient::Value(float Val)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGCoefficient::Value(void)
|
||||
double FGCoefficient::Value(void)
|
||||
{
|
||||
float Value;
|
||||
double Value;
|
||||
|
||||
SD = Value = StaticValue;
|
||||
|
||||
|
@ -222,7 +222,7 @@ float FGCoefficient::Value(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGCoefficient::TotalValue()
|
||||
double FGCoefficient::TotalValue()
|
||||
{
|
||||
|
||||
switch(type) {
|
||||
|
|
|
@ -104,9 +104,9 @@ public:
|
|||
virtual bool Load(FGConfigFile* AC_cfg);
|
||||
|
||||
typedef vector <eParam> MultVec;
|
||||
virtual float TotalValue(void);
|
||||
virtual double TotalValue(void);
|
||||
virtual inline string Getname(void) {return name;}
|
||||
virtual inline float GetSD(void) { return SD;}
|
||||
virtual inline double GetSD(void) { return SD;}
|
||||
inline MultVec Getmultipliers(void) {return multipliers;}
|
||||
void DumpSD(void);
|
||||
|
||||
|
@ -126,15 +126,15 @@ private:
|
|||
string description;
|
||||
string name;
|
||||
string method;
|
||||
float Value(float, float);
|
||||
float Value(float);
|
||||
float Value(void);
|
||||
float StaticValue;
|
||||
double Value(double, double);
|
||||
double Value(double);
|
||||
double Value(void);
|
||||
double StaticValue;
|
||||
eParam LookupR, LookupC;
|
||||
MultVec multipliers;
|
||||
int rows, columns;
|
||||
Type type;
|
||||
float SD; // Actual stability derivative (or other coefficient) value
|
||||
double SD; // Actual stability derivative (or other coefficient) value
|
||||
FGTable *Table;
|
||||
|
||||
FGFDMExec* FDMExec;
|
||||
|
|
|
@ -218,7 +218,7 @@ FGColumnVector3 operator*(const double scalar, const FGColumnVector3& C)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGColumnVector3::Magnitude(void)
|
||||
double FGColumnVector3::Magnitude(void)
|
||||
{
|
||||
double num;
|
||||
|
||||
|
@ -307,7 +307,7 @@ ostream& operator<<(ostream& os, const FGColumnVector3& col)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
FGColumnVector3& FGColumnVector3::operator<<(const float ff)
|
||||
FGColumnVector3& FGColumnVector3::operator<<(const double ff)
|
||||
{
|
||||
data[rowCtr] = ff;
|
||||
if (++rowCtr > 3 )
|
||||
|
|
|
@ -95,12 +95,12 @@ public:
|
|||
void operator*=(const double scalar);
|
||||
void operator/=(const double scalar);
|
||||
|
||||
FGColumnVector3& operator<<(const float ff);
|
||||
FGColumnVector3& operator<<(const double ff);
|
||||
|
||||
inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; }
|
||||
inline void InitMatrix(float ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
|
||||
inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
|
||||
|
||||
float Magnitude(void);
|
||||
double Magnitude(void);
|
||||
FGColumnVector3 Normalize(void);
|
||||
|
||||
friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A);
|
||||
|
|
|
@ -204,7 +204,7 @@ FGColumnVector4 operator*(const double scalar, const FGColumnVector4& C)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGColumnVector4::Magnitude(void)
|
||||
double FGColumnVector4::Magnitude(void)
|
||||
{
|
||||
double num;
|
||||
|
||||
|
@ -299,7 +299,7 @@ ostream& operator<<(ostream& os, FGColumnVector4& col)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
FGColumnVector4& FGColumnVector4::operator<<(const float ff)
|
||||
FGColumnVector4& FGColumnVector4::operator<<(const double ff)
|
||||
{
|
||||
data[rowCtr] = ff;
|
||||
if (++rowCtr > 4 )
|
||||
|
|
|
@ -95,12 +95,12 @@ public:
|
|||
inline double operator()(int m) const { return data[m]; }
|
||||
inline double& operator()(int m) { return data[m]; }
|
||||
|
||||
FGColumnVector4& operator<<(const float ff);
|
||||
FGColumnVector4& operator<<(const double ff);
|
||||
|
||||
inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; }
|
||||
inline void InitMatrix(float ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
|
||||
inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
|
||||
|
||||
float Magnitude(void);
|
||||
double Magnitude(void);
|
||||
FGColumnVector4 Normalize(void);
|
||||
|
||||
friend FGColumnVector4 operator*(const double scalar, const FGColumnVector4& A);
|
||||
|
|
|
@ -60,34 +60,56 @@ FGConfigFile::~FGConfigFile()
|
|||
|
||||
string FGConfigFile::GetNextConfigLine(void)
|
||||
{
|
||||
int deblank;
|
||||
int deblank, not_found = string::npos;
|
||||
int comment_starts_at;
|
||||
int comment_ends_at;
|
||||
int comment_length;
|
||||
int line_length;
|
||||
bool start_comment, end_comment;
|
||||
string CommentStringTemp;
|
||||
|
||||
do {
|
||||
CurrentLine = GetLine();
|
||||
if (CurrentLine.find("<!--") != CurrentLine.npos) {
|
||||
CommentsOn = true;
|
||||
CommentString = "";
|
||||
if (CurrentLine.find("<!--") != CurrentLine.npos)
|
||||
CurrentLine.erase(CurrentLine.find("<!--"),4);
|
||||
while((deblank = CurrentLine.find(" ")) != CurrentLine.npos) CurrentLine.erase(deblank,1);
|
||||
if (CurrentLine.size() <= 2) CurrentLine = "";
|
||||
}
|
||||
line_length = CurrentLine.length();
|
||||
comment_starts_at = CurrentLine.find("<!--");
|
||||
|
||||
if (CurrentLine.find("-->") != CurrentLine.npos) {
|
||||
if (comment_starts_at >= 0) start_comment = true;
|
||||
else start_comment = false;
|
||||
|
||||
comment_ends_at = CurrentLine.find("-->");
|
||||
|
||||
if (comment_ends_at >= 0) end_comment = true;
|
||||
else end_comment = false;
|
||||
|
||||
if (!start_comment && !end_comment) { // command comment
|
||||
if (CommentsOn) CommentStringTemp = CurrentLine;
|
||||
CommentString += CommentStringTemp + "\r\n";
|
||||
} else if (start_comment && comment_ends_at > comment_starts_at) { // <!-- ... -->
|
||||
CommentsOn = false;
|
||||
|
||||
if (CurrentLine.find("-->") != CurrentLine.npos)
|
||||
CurrentLine.erase(CurrentLine.find("-->"),4);
|
||||
|
||||
while((deblank = CurrentLine.find(" ")) != CurrentLine.npos) CurrentLine.erase(deblank,1);
|
||||
if (CurrentLine.size() <= 2) CurrentLine = "";
|
||||
|
||||
CommentString += CurrentLine;
|
||||
GetNextConfigLine();
|
||||
comment_length = comment_ends_at + 2 - comment_starts_at + 1;
|
||||
LineComment = CurrentLine.substr(comment_starts_at+4, comment_length-4-3);
|
||||
CurrentLine.erase(comment_starts_at, comment_length);
|
||||
} else if ( start_comment && !end_comment) { // <!-- ...
|
||||
CommentsOn = true;
|
||||
comment_length = line_length - comment_starts_at;
|
||||
CommentStringTemp = CurrentLine.substr(comment_starts_at+4, comment_length-4);
|
||||
CommentString = CommentStringTemp + "\r\n";
|
||||
CurrentLine.erase(comment_starts_at, comment_length);
|
||||
} else if (!start_comment && end_comment) { // ... -->
|
||||
CommentsOn = false;
|
||||
comment_length = comment_ends_at + 2 + 1;
|
||||
CommentStringTemp = CurrentLine.substr(0, comment_length-4);
|
||||
CommentString += CommentStringTemp + "\r\n";
|
||||
CurrentLine.erase(0, comment_length);
|
||||
} else if (start_comment && comment_ends_at < comment_starts_at) { // --> command <!--
|
||||
cerr << "Old comment ends and new one starts - bad JSBSim config file form." << endl;
|
||||
CommentsOn = false;
|
||||
comment_length = comment_ends_at + 2 + 1;
|
||||
CommentStringTemp = CurrentLine.substr(0, comment_length-4);
|
||||
CommentString += CommentStringTemp + "\r\n";
|
||||
CurrentLine.erase(0, comment_length);
|
||||
}
|
||||
|
||||
if (CommentsOn) CommentString += CurrentLine + "\r\n";
|
||||
|
||||
} while (CommentsOn);
|
||||
|
||||
if (CurrentLine.length() == 0) GetNextConfigLine();
|
||||
|
@ -97,13 +119,6 @@ string FGConfigFile::GetNextConfigLine(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
string FGConfigFile::GetCommentString(void)
|
||||
{
|
||||
return CommentString;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
string FGConfigFile::GetValue(string val)
|
||||
{
|
||||
unsigned int pos, p1, p2, ptest;
|
||||
|
@ -186,14 +201,18 @@ string FGConfigFile::GetLine(void)
|
|||
int test;
|
||||
|
||||
while ((test = cfgfile.get()) != EOF) {
|
||||
if (test >= 0x20) {
|
||||
scratch += (char)test;
|
||||
if (test >= 0x20 || test == 0x09) {
|
||||
if (test == 0x09) {
|
||||
scratch += (char)0x20;
|
||||
} else {
|
||||
scratch += (char)test;
|
||||
}
|
||||
} else {
|
||||
if ((test = cfgfile.get()) != EOF) {
|
||||
if ((test = cfgfile.get()) != EOF) { // get *next* character
|
||||
#if defined ( sgi ) && !defined( __GNUC__ )
|
||||
if (test >= 0x20) cfgfile.putback(test);
|
||||
if (test >= 0x20 || test == 0x09) cfgfile.putback(test);
|
||||
#else
|
||||
if (test >= 0x20) cfgfile.unget();
|
||||
if (test >= 0x20 || test == 0x09) cfgfile.unget();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -204,7 +223,7 @@ string FGConfigFile::GetLine(void)
|
|||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
/*
|
||||
FGConfigFile& FGConfigFile::operator>>(double& val)
|
||||
{
|
||||
unsigned int pos, end;
|
||||
|
@ -219,10 +238,10 @@ FGConfigFile& FGConfigFile::operator>>(double& val)
|
|||
if (CurrentIndex >= CurrentLine.length()) GetNextConfigLine();
|
||||
return *this;
|
||||
}
|
||||
|
||||
*/
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
FGConfigFile& FGConfigFile::operator>>(float& val)
|
||||
FGConfigFile& FGConfigFile::operator>>(double& val)
|
||||
{
|
||||
unsigned int pos, end;
|
||||
|
||||
|
|
|
@ -116,10 +116,11 @@ public:
|
|||
string GetNextConfigLine(void);
|
||||
string GetValue(string);
|
||||
string GetValue(void);
|
||||
string GetCommentString(void);
|
||||
string GetCommentString(void) {return CommentString;}
|
||||
string GetLineComment(void) {return LineComment;}
|
||||
bool IsOpen(void) {return Opened;}
|
||||
// FGConfigFile& operator>>(double&);
|
||||
FGConfigFile& operator>>(double&);
|
||||
FGConfigFile& operator>>(float&);
|
||||
FGConfigFile& operator>>(int&);
|
||||
FGConfigFile& operator>>(string&);
|
||||
FGConfigFile& operator>>(eParam&);
|
||||
|
@ -129,6 +130,7 @@ private:
|
|||
ifstream cfgfile;
|
||||
string CurrentLine;
|
||||
string CommentString;
|
||||
string LineComment;
|
||||
bool CommentsOn;
|
||||
bool Opened;
|
||||
unsigned int CurrentIndex;
|
||||
|
|
|
@ -102,11 +102,10 @@ FGEngine::~FGEngine()
|
|||
// and sets the starved flag if necessary.
|
||||
|
||||
void FGEngine::ConsumeFuel(void) {
|
||||
float Fshortage, Oshortage;
|
||||
double Fshortage, Oshortage;
|
||||
FGTank* Tank;
|
||||
|
||||
if (TrimMode) return;
|
||||
|
||||
Fshortage = Oshortage = 0.0;
|
||||
for (unsigned int i=0; i<SourceTanks.size(); i++) {
|
||||
Tank = Propulsion->GetTank(i);
|
||||
|
@ -123,21 +122,21 @@ void FGEngine::ConsumeFuel(void) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGEngine::CalcFuelNeed(void) {
|
||||
double FGEngine::CalcFuelNeed(void) {
|
||||
FuelNeed = SLFuelFlowMax*PctPower*State->Getdt()*Propulsion->GetRate();
|
||||
return FuelNeed;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGEngine::CalcOxidizerNeed(void) {
|
||||
double FGEngine::CalcOxidizerNeed(void) {
|
||||
OxidizerNeed = SLOxiFlowMax*PctPower*State->Getdt()*Propulsion->GetRate();
|
||||
return OxidizerNeed;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGEngine::SetPlacement(float x, float y, float z, float pitch, float yaw) {
|
||||
void FGEngine::SetPlacement(double x, double y, double z, double pitch, double yaw) {
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
|
|
|
@ -113,13 +113,13 @@ public:
|
|||
|
||||
enum EngineType {etUnknown, etRocket, etPiston, etTurboProp, etTurboJet, etTurboShaft};
|
||||
|
||||
virtual float GetThrottleMin(void) { return MinThrottle; }
|
||||
virtual float GetThrottleMax(void) { return MaxThrottle; }
|
||||
float GetThrottle(void) { return Throttle; }
|
||||
float GetMixture(void) { return Mixture; }
|
||||
virtual double GetThrottleMin(void) { return MinThrottle; }
|
||||
virtual double GetThrottleMax(void) { return MaxThrottle; }
|
||||
double GetThrottle(void) { return Throttle; }
|
||||
double GetMixture(void) { return Mixture; }
|
||||
int GetMagnetos(void) { return Magnetos; }
|
||||
bool GetStarter(void) { return Starter; }
|
||||
float GetThrust(void) { return Thrust; }
|
||||
double GetThrust(void) { return Thrust; }
|
||||
bool GetStarved(void) { return Starved; }
|
||||
bool GetFlameout(void) { return Flameout; }
|
||||
bool GetRunning(void) { return Running; }
|
||||
|
@ -127,19 +127,19 @@ public:
|
|||
int GetType(void) { return Type; }
|
||||
string GetName(void) { return Name; }
|
||||
|
||||
virtual float getManifoldPressure_inHg () const {
|
||||
virtual double getManifoldPressure_inHg () const {
|
||||
return ManifoldPressure_inHg;
|
||||
}
|
||||
virtual float getExhaustGasTemp_degF () const {
|
||||
virtual double getExhaustGasTemp_degF () const {
|
||||
return (ExhaustGasTemp_degK - 273) * (9.0 / 5.0) + 32.0;
|
||||
}
|
||||
virtual float getCylinderHeadTemp_degF () const {
|
||||
virtual double getCylinderHeadTemp_degF () const {
|
||||
return (CylinderHeadTemp_degK - 273) * (9.0 / 5.0) + 32.0;
|
||||
}
|
||||
virtual float getOilPressure_psi () const {
|
||||
virtual double getOilPressure_psi () const {
|
||||
return OilPressure_psi;
|
||||
}
|
||||
virtual float getOilTemp_degF () const {
|
||||
virtual double getOilTemp_degF () const {
|
||||
return (OilTemp_degK - 273.0) * (9.0 / 5.0) + 32.0;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
such as a propeller. This resisting effect must be provided to the
|
||||
engine model.
|
||||
@return Thrust in pounds */
|
||||
virtual float Calculate(float PowerRequired) {return 0.0;};
|
||||
virtual double Calculate(double PowerRequired) {return 0.0;};
|
||||
|
||||
/** Reduces the fuel in the active tanks by the amount required.
|
||||
This function should be called from within the
|
||||
|
@ -171,18 +171,18 @@ public:
|
|||
power level. It is also turned from a rate into an actual amount (pounds)
|
||||
by multiplying it by the delta T and the rate.
|
||||
@return Total fuel requirement for this engine in pounds. */
|
||||
float CalcFuelNeed(void);
|
||||
double CalcFuelNeed(void);
|
||||
|
||||
/** The oxidizer need is calculated based on power levels and flow rate for that
|
||||
power level. It is also turned from a rate into an actual amount (pounds)
|
||||
by multiplying it by the delta T and the rate.
|
||||
@return Total oxidizer requirement for this engine in pounds. */
|
||||
float CalcOxidizerNeed(void);
|
||||
double CalcOxidizerNeed(void);
|
||||
|
||||
/// Sets engine placement information
|
||||
void SetPlacement(float x, float y, float z, float pitch, float yaw);
|
||||
void SetPlacement(double x, double y, double z, double pitch, double yaw);
|
||||
|
||||
virtual float GetPowerAvailable(void) {return 0.0;};
|
||||
virtual double GetPowerAvailable(void) {return 0.0;};
|
||||
|
||||
bool GetTrimMode(void) {return TrimMode;}
|
||||
void SetTrimMode(bool state) {TrimMode = state;}
|
||||
|
@ -190,33 +190,33 @@ public:
|
|||
protected:
|
||||
string Name;
|
||||
EngineType Type;
|
||||
float X, Y, Z;
|
||||
float EnginePitch;
|
||||
float EngineYaw;
|
||||
float SLFuelFlowMax;
|
||||
float SLOxiFlowMax;
|
||||
float MaxThrottle;
|
||||
float MinThrottle;
|
||||
double X, Y, Z;
|
||||
double EnginePitch;
|
||||
double EngineYaw;
|
||||
double SLFuelFlowMax;
|
||||
double SLOxiFlowMax;
|
||||
double MaxThrottle;
|
||||
double MinThrottle;
|
||||
|
||||
float Thrust;
|
||||
float Throttle;
|
||||
float Mixture;
|
||||
double Thrust;
|
||||
double Throttle;
|
||||
double Mixture;
|
||||
int Magnetos;
|
||||
bool Starter;
|
||||
float FuelNeed, OxidizerNeed;
|
||||
double FuelNeed, OxidizerNeed;
|
||||
bool Starved;
|
||||
bool Flameout;
|
||||
bool Running;
|
||||
bool Cranking;
|
||||
float PctPower;
|
||||
double PctPower;
|
||||
int EngineNumber;
|
||||
bool TrimMode;
|
||||
|
||||
float ManifoldPressure_inHg;
|
||||
float ExhaustGasTemp_degK;
|
||||
float CylinderHeadTemp_degK;
|
||||
float OilPressure_psi;
|
||||
float OilTemp_degK;
|
||||
double ManifoldPressure_inHg;
|
||||
double ExhaustGasTemp_degK;
|
||||
double CylinderHeadTemp_degK;
|
||||
double OilPressure_psi;
|
||||
double OilTemp_degK;
|
||||
|
||||
FGFDMExec* FDMExec;
|
||||
FGState* State;
|
||||
|
|
|
@ -107,13 +107,13 @@ bool FGFCS::Run(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGFCS::SetThrottleCmd(int engineNum, float setting)
|
||||
void FGFCS::SetThrottleCmd(int engineNum, double setting)
|
||||
{
|
||||
unsigned int ctr;
|
||||
|
||||
if ((int)ThrottleCmd.size() > engineNum) {
|
||||
if (engineNum < (int)ThrottlePos.size()) {
|
||||
if (engineNum < 0) {
|
||||
for (ctr=0;ctr<=ThrottleCmd.size();ctr++) ThrottleCmd[ctr] = setting;
|
||||
for (ctr=0;ctr<ThrottleCmd.size();ctr++) ThrottleCmd[ctr] = setting;
|
||||
} else {
|
||||
ThrottleCmd[engineNum] = setting;
|
||||
}
|
||||
|
@ -126,13 +126,13 @@ void FGFCS::SetThrottleCmd(int engineNum, float setting)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGFCS::SetThrottlePos(int engineNum, float setting)
|
||||
void FGFCS::SetThrottlePos(int engineNum, double setting)
|
||||
{
|
||||
unsigned int ctr;
|
||||
|
||||
if ((int)ThrottlePos.size() > engineNum) {
|
||||
if (engineNum < (int)ThrottlePos.size()) {
|
||||
if (engineNum < 0) {
|
||||
for (ctr=0;ctr<=ThrottlePos.size();ctr++) ThrottlePos[ctr] = setting;
|
||||
for (ctr=0;ctr<ThrottlePos.size();ctr++) ThrottlePos[ctr] = setting;
|
||||
} else {
|
||||
ThrottlePos[engineNum] = setting;
|
||||
}
|
||||
|
@ -145,9 +145,9 @@ void FGFCS::SetThrottlePos(int engineNum, float setting)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGFCS::GetThrottleCmd(int engineNum)
|
||||
double FGFCS::GetThrottleCmd(int engineNum)
|
||||
{
|
||||
if ((int)ThrottleCmd.size() > engineNum) {
|
||||
if (engineNum < (int)ThrottlePos.size()) {
|
||||
if (engineNum < 0) {
|
||||
cerr << "Cannot get throttle value for ALL engines" << endl;
|
||||
} else {
|
||||
|
@ -162,9 +162,9 @@ float FGFCS::GetThrottleCmd(int engineNum)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGFCS::GetThrottlePos(int engineNum)
|
||||
double FGFCS::GetThrottlePos(int engineNum)
|
||||
{
|
||||
if ((int)ThrottlePos.size() > engineNum) {
|
||||
if (engineNum < (int)ThrottlePos.size()) {
|
||||
if (engineNum < 0) {
|
||||
cerr << "Cannot get throttle value for ALL engines" << endl;
|
||||
} else {
|
||||
|
@ -179,27 +179,31 @@ float FGFCS::GetThrottlePos(int engineNum)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGFCS::SetMixtureCmd(int engineNum, float setting)
|
||||
void FGFCS::SetMixtureCmd(int engineNum, double setting)
|
||||
{
|
||||
unsigned int ctr;
|
||||
|
||||
if (engineNum < 0) {
|
||||
for (ctr=0;ctr<MixtureCmd.size();ctr++) MixtureCmd[ctr] = setting;
|
||||
} else {
|
||||
MixtureCmd[engineNum] = setting;
|
||||
if (engineNum < (int)ThrottlePos.size()) {
|
||||
if (engineNum < 0) {
|
||||
for (ctr=0;ctr<MixtureCmd.size();ctr++) MixtureCmd[ctr] = setting;
|
||||
} else {
|
||||
MixtureCmd[engineNum] = setting;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGFCS::SetMixturePos(int engineNum, float setting)
|
||||
void FGFCS::SetMixturePos(int engineNum, double setting)
|
||||
{
|
||||
unsigned int ctr;
|
||||
|
||||
if (engineNum < 0) {
|
||||
for (ctr=0;ctr<=MixtureCmd.size();ctr++) MixturePos[ctr] = MixtureCmd[ctr];
|
||||
} else {
|
||||
MixturePos[engineNum] = setting;
|
||||
if (engineNum < (int)ThrottlePos.size()) {
|
||||
if (engineNum < 0) {
|
||||
for (ctr=0;ctr<=MixtureCmd.size();ctr++) MixturePos[ctr] = MixtureCmd[ctr];
|
||||
} else {
|
||||
MixturePos[engineNum] = setting;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +216,7 @@ bool FGFCS::Load(FGConfigFile* AC_cfg)
|
|||
Name = Name + ":" + AC_cfg->GetValue("NAME");
|
||||
if (debug_lvl > 0) cout << " Control System Name: " << Name << endl;
|
||||
AC_cfg->GetNextConfigLine();
|
||||
while ((token = AC_cfg->GetValue()) != "/FLIGHT_CONTROL") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/FLIGHT_CONTROL")) {
|
||||
if (token == "COMPONENT") {
|
||||
token = AC_cfg->GetValue("TYPE");
|
||||
if (debug_lvl > 0) cout << " Loading Component \""
|
||||
|
@ -252,7 +256,7 @@ bool FGFCS::Load(FGConfigFile* AC_cfg)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGFCS::GetComponentOutput(eParam idx) {
|
||||
double FGFCS::GetComponentOutput(eParam idx) {
|
||||
return Components[idx]->GetOutput();
|
||||
}
|
||||
|
||||
|
@ -264,7 +268,7 @@ string FGFCS::GetComponentName(int idx) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGFCS::GetBrake(FGLGear::BrakeGroup bg) {
|
||||
double FGFCS::GetBrake(FGLGear::BrakeGroup bg) {
|
||||
switch (bg) {
|
||||
case FGLGear::bgLeft:
|
||||
return LeftBrake;
|
||||
|
|
|
@ -171,78 +171,78 @@ public:
|
|||
//@{
|
||||
/** Gets the aileron command.
|
||||
@return aileron command in radians */
|
||||
inline float GetDaCmd(void) { return DaCmd; }
|
||||
inline double GetDaCmd(void) { return DaCmd; }
|
||||
|
||||
/** Gets the elevator command.
|
||||
@return elevator command in radians */
|
||||
inline float GetDeCmd(void) { return DeCmd; }
|
||||
inline double GetDeCmd(void) { return DeCmd; }
|
||||
|
||||
/** Gets the rudder command.
|
||||
@return rudder command in radians */
|
||||
inline float GetDrCmd(void) { return DrCmd; }
|
||||
inline double GetDrCmd(void) { return DrCmd; }
|
||||
|
||||
/** Gets the flaps command.
|
||||
@return flaps command in radians */
|
||||
inline float GetDfCmd(void) { return DfCmd; }
|
||||
inline double GetDfCmd(void) { return DfCmd; }
|
||||
|
||||
/** Gets the speedbrake command.
|
||||
@return speedbrake command in radians */
|
||||
inline float GetDsbCmd(void) { return DsbCmd; }
|
||||
inline double GetDsbCmd(void) { return DsbCmd; }
|
||||
|
||||
/** Gets the spoiler command.
|
||||
@return spoiler command in radians */
|
||||
inline float GetDspCmd(void) { return DspCmd; }
|
||||
inline double GetDspCmd(void) { return DspCmd; }
|
||||
|
||||
/** Gets the throttle command.
|
||||
@param engine engine ID number
|
||||
@return throttle command in percent ( 0 - 100) for the given engine */
|
||||
float GetThrottleCmd(int engine);
|
||||
double GetThrottleCmd(int engine);
|
||||
|
||||
/** Gets the mixture command.
|
||||
@param engine engine ID number
|
||||
@return mixture command in percent ( 0 - 100) for the given engine */
|
||||
inline float GetMixtureCmd(int engine) { return MixtureCmd[engine]; }
|
||||
inline double GetMixtureCmd(int engine) { return MixtureCmd[engine]; }
|
||||
|
||||
/** Gets the pitch trim command.
|
||||
@return pitch trim command in radians */
|
||||
inline float GetPitchTrimCmd(void) { return PTrimCmd; }
|
||||
inline double GetPitchTrimCmd(void) { return PTrimCmd; }
|
||||
//@}
|
||||
|
||||
/// @name Aerosurface position retrieval
|
||||
//@{
|
||||
/** Gets the aileron position.
|
||||
@return aileron position in radians */
|
||||
inline float GetDaPos(void) { return DaPos; }
|
||||
inline double GetDaPos(void) { return DaPos; }
|
||||
|
||||
/** Gets the elevator position.
|
||||
@return elevator position in radians */
|
||||
inline float GetDePos(void) { return DePos; }
|
||||
inline double GetDePos(void) { return DePos; }
|
||||
|
||||
/** Gets the rudder position.
|
||||
@return rudder position in radians */
|
||||
inline float GetDrPos(void) { return DrPos; }
|
||||
inline double GetDrPos(void) { return DrPos; }
|
||||
|
||||
/** Gets the flaps position.
|
||||
@return flaps position in radians */
|
||||
inline float GetDfPos(void) { return DfPos; }
|
||||
inline double GetDfPos(void) { return DfPos; }
|
||||
|
||||
/** Gets the speedbrake position.
|
||||
@return speedbrake position in radians */
|
||||
inline float GetDsbPos(void) { return DsbPos; }
|
||||
inline double GetDsbPos(void) { return DsbPos; }
|
||||
|
||||
/** Gets the spoiler position.
|
||||
@return spoiler position in radians */
|
||||
inline float GetDspPos(void) { return DspPos; }
|
||||
inline double GetDspPos(void) { return DspPos; }
|
||||
|
||||
/** Gets the throttle position.
|
||||
@param engine engine ID number
|
||||
@return throttle position for the given engine in percent ( 0 - 100)*/
|
||||
float GetThrottlePos(int engine);
|
||||
double GetThrottlePos(int engine);
|
||||
|
||||
/** Gets the mixture position.
|
||||
@param engine engine ID number
|
||||
@return mixture position for the given engine in percent ( 0 - 100)*/
|
||||
inline float GetMixturePos(int engine) { return MixturePos[engine]; }
|
||||
inline double GetMixturePos(int engine) { return MixturePos[engine]; }
|
||||
//@}
|
||||
|
||||
/** Retrieves the State object pointer.
|
||||
|
@ -253,7 +253,7 @@ public:
|
|||
/** Retrieves a components output value
|
||||
@param idx the index of the component (the component ID)
|
||||
@return output value from the component */
|
||||
float GetComponentOutput(eParam idx);
|
||||
double GetComponentOutput(eParam idx);
|
||||
|
||||
/** Retrieves the component name
|
||||
@param idx the index of the component (the component ID)
|
||||
|
@ -270,98 +270,98 @@ public:
|
|||
//@{
|
||||
/** Sets the aileron command
|
||||
@param cmd aileron command in radians*/
|
||||
inline void SetDaCmd(float cmd) { DaCmd = cmd; }
|
||||
inline void SetDaCmd(double cmd) { DaCmd = cmd; }
|
||||
|
||||
/** Sets the elevator command
|
||||
@param cmd elevator command in radians*/
|
||||
inline void SetDeCmd(float cmd) { DeCmd = cmd; }
|
||||
inline void SetDeCmd(double cmd) { DeCmd = cmd; }
|
||||
|
||||
/** Sets the rudder command
|
||||
@param cmd rudder command in radians*/
|
||||
inline void SetDrCmd(float cmd) { DrCmd = cmd; }
|
||||
inline void SetDrCmd(double cmd) { DrCmd = cmd; }
|
||||
|
||||
/** Sets the flaps command
|
||||
@param cmd flaps command in radians*/
|
||||
inline void SetDfCmd(float cmd) { DfCmd = cmd; }
|
||||
inline void SetDfCmd(double cmd) { DfCmd = cmd; }
|
||||
|
||||
/** Sets the speedbrake command
|
||||
@param cmd speedbrake command in radians*/
|
||||
inline void SetDsbCmd(float cmd) { DsbCmd = cmd; }
|
||||
inline void SetDsbCmd(double cmd) { DsbCmd = cmd; }
|
||||
|
||||
/** Sets the spoilers command
|
||||
@param cmd spoilers command in radians*/
|
||||
inline void SetDspCmd(float cmd) { DspCmd = cmd; }
|
||||
inline void SetDspCmd(double cmd) { DspCmd = cmd; }
|
||||
|
||||
/** Sets the pitch trim command
|
||||
@param cmd pitch trim command in radians*/
|
||||
inline void SetPitchTrimCmd(float cmd) { PTrimCmd = cmd; }
|
||||
inline void SetPitchTrimCmd(double cmd) { PTrimCmd = cmd; }
|
||||
|
||||
/** Sets the throttle command for the specified engine
|
||||
@param engine engine ID number
|
||||
@param cmd throttle command in percent (0 - 100)*/
|
||||
void SetThrottleCmd(int engine, float cmd);
|
||||
void SetThrottleCmd(int engine, double cmd);
|
||||
|
||||
/** Sets the mixture command for the specified engine
|
||||
@param engine engine ID number
|
||||
@param cmd mixture command in percent (0 - 100)*/
|
||||
void SetMixtureCmd(int engine, float cmd);
|
||||
void SetMixtureCmd(int engine, double cmd);
|
||||
//@}
|
||||
|
||||
/// @name Aerosurface position setting
|
||||
//@{
|
||||
/** Sets the aileron position
|
||||
@param cmd aileron position in radians*/
|
||||
inline void SetDaPos(float cmd) { DaPos = cmd; }
|
||||
inline void SetDaPos(double cmd) { DaPos = cmd; }
|
||||
|
||||
/** Sets the elevator position
|
||||
@param cmd elevator position in radians*/
|
||||
inline void SetDePos(float cmd) { DePos = cmd; }
|
||||
inline void SetDePos(double cmd) { DePos = cmd; }
|
||||
|
||||
/** Sets the rudder position
|
||||
@param cmd rudder position in radians*/
|
||||
inline void SetDrPos(float cmd) { DrPos = cmd; }
|
||||
inline void SetDrPos(double cmd) { DrPos = cmd; }
|
||||
|
||||
/** Sets the flaps position
|
||||
@param cmd flaps position in radians*/
|
||||
inline void SetDfPos(float cmd) { DfPos = cmd; }
|
||||
inline void SetDfPos(double cmd) { DfPos = cmd; }
|
||||
|
||||
/** Sets the speedbrake position
|
||||
@param cmd speedbrake position in radians*/
|
||||
inline void SetDsbPos(float cmd) { DsbPos = cmd; }
|
||||
inline void SetDsbPos(double cmd) { DsbPos = cmd; }
|
||||
|
||||
/** Sets the spoiler position
|
||||
@param cmd spoiler position in radians*/
|
||||
inline void SetDspPos(float cmd) { DspPos = cmd; }
|
||||
inline void SetDspPos(double cmd) { DspPos = cmd; }
|
||||
|
||||
/** Sets the actual throttle setting for the specified engine
|
||||
@param engine engine ID number
|
||||
@param cmd throttle setting in percent (0 - 100)*/
|
||||
void SetThrottlePos(int engine, float cmd);
|
||||
void SetThrottlePos(int engine, double cmd);
|
||||
|
||||
/** Sets the actual mixture setting for the specified engine
|
||||
@param engine engine ID number
|
||||
@param cmd mixture setting in percent (0 - 100)*/
|
||||
void SetMixturePos(int engine, float cmd);
|
||||
void SetMixturePos(int engine, double cmd);
|
||||
//@}
|
||||
|
||||
/// @name Landing Gear brakes
|
||||
//@{
|
||||
/** Sets the left brake group
|
||||
@param cmd brake setting in percent (0.0 - 1.0) */
|
||||
void SetLBrake(float cmd) {LeftBrake = cmd;}
|
||||
void SetLBrake(double cmd) {LeftBrake = cmd;}
|
||||
|
||||
/** Sets the right brake group
|
||||
@param cmd brake setting in percent (0.0 - 1.0) */
|
||||
void SetRBrake(float cmd) {RightBrake = cmd;}
|
||||
void SetRBrake(double cmd) {RightBrake = cmd;}
|
||||
|
||||
/** Sets the center brake group
|
||||
@param cmd brake setting in percent (0.0 - 1.0) */
|
||||
void SetCBrake(float cmd) {CenterBrake = cmd;}
|
||||
void SetCBrake(double cmd) {CenterBrake = cmd;}
|
||||
|
||||
/** Gets the brake for a specified group.
|
||||
@param bg which brakegroup to retrieve the command for
|
||||
@return the brake setting for the supplied brake group argument */
|
||||
float GetBrake(FGLGear::BrakeGroup bg);
|
||||
double GetBrake(FGLGear::BrakeGroup bg);
|
||||
//@}
|
||||
|
||||
/** Loads the Flight Control System.
|
||||
|
@ -375,14 +375,14 @@ public:
|
|||
void AddThrottle(void);
|
||||
|
||||
private:
|
||||
float DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
|
||||
float DaPos, DePos, DrPos, DfPos, DsbPos, DspPos;
|
||||
float PTrimCmd;
|
||||
vector <float> ThrottleCmd;
|
||||
vector <float> ThrottlePos;
|
||||
vector <float> MixtureCmd;
|
||||
vector <float> MixturePos;
|
||||
float LeftBrake, RightBrake, CenterBrake; // Brake settings
|
||||
double DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
|
||||
double DaPos, DePos, DrPos, DfPos, DsbPos, DspPos;
|
||||
double PTrimCmd;
|
||||
vector <double> ThrottleCmd;
|
||||
vector <double> ThrottlePos;
|
||||
vector <double> MixtureCmd;
|
||||
vector <double> MixturePos;
|
||||
double LeftBrake, RightBrake, CenterBrake; // Brake settings
|
||||
|
||||
vector <FGFCSComponent*> Components;
|
||||
void Debug(void);
|
||||
|
|
|
@ -320,6 +320,7 @@ int FGFDMExec::Schedule(FGModel* model, int rate)
|
|||
model_iterator->NextModel->SetRate(rate);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -413,7 +414,7 @@ bool FGFDMExec::LoadScript(string script)
|
|||
string aircraft="";
|
||||
string initialize="";
|
||||
bool result=false;
|
||||
float dt=0.0;
|
||||
double dt=0.0;
|
||||
int i;
|
||||
struct condition *newCondition;
|
||||
|
||||
|
@ -424,13 +425,13 @@ bool FGFDMExec::LoadScript(string script)
|
|||
Scripted = true;
|
||||
if (debug_lvl > 0) cout << "Reading Script File " << ScriptName << endl;
|
||||
|
||||
while (Script.GetNextConfigLine() != "EOF" && Script.GetValue() != "/runscript") {
|
||||
while (Script.GetNextConfigLine() != string("EOF") && Script.GetValue() != string("/runscript")) {
|
||||
token = Script.GetValue();
|
||||
if (token == "use") {
|
||||
if ((token = Script.GetValue("aircraft")) != "") {
|
||||
if ((token = Script.GetValue("aircraft")) != string("")) {
|
||||
aircraft = token;
|
||||
if (debug_lvl > 0) cout << " Use aircraft: " << token << endl;
|
||||
} else if ((token = Script.GetValue("initialize")) != "") {
|
||||
} else if ((token = Script.GetValue("initialize")) != string("")) {
|
||||
initialize = token;
|
||||
if (debug_lvl > 0) cout << " Use reset file: " << token << endl;
|
||||
} else {
|
||||
|
@ -444,13 +445,13 @@ bool FGFDMExec::LoadScript(string script)
|
|||
State->Setdt(dt);
|
||||
Script.GetNextConfigLine();
|
||||
token = Script.GetValue();
|
||||
while (token != "/run") {
|
||||
while (token != string("/run")) {
|
||||
|
||||
if (token == "when") {
|
||||
Script.GetNextConfigLine();
|
||||
token = Script.GetValue();
|
||||
newCondition = new struct condition();
|
||||
while (token != "/when") {
|
||||
while (token != string("/when")) {
|
||||
if (token == "parameter") {
|
||||
newCondition->TestParam.push_back(State->GetParameterIndex(Script.GetValue("name")));
|
||||
newCondition->TestValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
|
||||
|
@ -599,8 +600,8 @@ void FGFDMExec::RunScript(void)
|
|||
|
||||
int count=0;
|
||||
|
||||
float currentTime = State->Getsim_time();
|
||||
float newSetValue;
|
||||
double currentTime = State->Getsim_time();
|
||||
double newSetValue;
|
||||
|
||||
while (iC < Conditions.end()) {
|
||||
// determine whether the set of conditional tests for this condition equate
|
||||
|
@ -668,6 +669,9 @@ void FGFDMExec::RunScript(void)
|
|||
break;
|
||||
}
|
||||
State->SetParameter(iC->SetParam[i], newSetValue);
|
||||
if ((unsigned long int)Propulsion->GetTank(0) == 0) {
|
||||
cout << "Param # getting set: " << iC->SetParam[i] << " Value: " << newSetValue << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
iC++;
|
||||
|
|
|
@ -294,18 +294,18 @@ private:
|
|||
struct condition {
|
||||
vector <eParam> TestParam;
|
||||
vector <eParam> SetParam;
|
||||
vector <float> TestValue;
|
||||
vector <float> SetValue;
|
||||
vector <double> TestValue;
|
||||
vector <double> SetValue;
|
||||
vector <string> Comparison;
|
||||
vector <float> TC;
|
||||
vector <double> TC;
|
||||
vector <bool> Persistent;
|
||||
vector <eAction> Action;
|
||||
vector <eType> Type;
|
||||
vector <bool> Triggered;
|
||||
vector <float> newValue;
|
||||
vector <float> OriginalValue;
|
||||
vector <float> StartTime;
|
||||
vector <float> EndTime;
|
||||
vector <double> newValue;
|
||||
vector <double> OriginalValue;
|
||||
vector <double> StartTime;
|
||||
vector <double> EndTime;
|
||||
|
||||
condition() {
|
||||
}
|
||||
|
@ -326,8 +326,8 @@ private:
|
|||
string EnginePath;
|
||||
string ScriptPath;
|
||||
string ScriptName;
|
||||
float StartTime;
|
||||
float EndTime;
|
||||
double StartTime;
|
||||
double EndTime;
|
||||
vector <struct condition> Conditions;
|
||||
|
||||
FGState* State;
|
||||
|
|
|
@ -99,7 +99,7 @@ bool FGFactorGroup::Load(FGConfigFile *AC_cfg) {
|
|||
//if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
|
||||
}
|
||||
token = AC_cfg->GetValue();
|
||||
while ( token != "/GROUP" ) {
|
||||
while ( token != string("/GROUP") ) {
|
||||
sum.push_back( new FGCoefficient(FDMExec) );
|
||||
sum.back()->Load(AC_cfg);
|
||||
//if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
|
||||
|
@ -114,9 +114,9 @@ bool FGFactorGroup::Load(FGConfigFile *AC_cfg) {
|
|||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
float FGFactorGroup::TotalValue(void) {
|
||||
double FGFactorGroup::TotalValue(void) {
|
||||
int i;
|
||||
float totalsum=0;
|
||||
double totalsum=0;
|
||||
SDtotal=0.0;
|
||||
for(i=0;i<sum.size();i++) {
|
||||
totalsum+=sum[i]->TotalValue();
|
||||
|
|
|
@ -98,11 +98,11 @@ class FGFactorGroup: public FGCoefficient {
|
|||
~FGFactorGroup();
|
||||
|
||||
bool Load(FGConfigFile *AC_cfg);
|
||||
float TotalValue(void);
|
||||
double TotalValue(void);
|
||||
//string GetCoefficientStrings(void);
|
||||
//string GetCoefficientValues(void);
|
||||
inline float GetSD(void) { return SDtotal; }
|
||||
inline float GetFactorSD(void) { return FGCoefficient::GetSD(); }
|
||||
inline double GetSD(void) { return SDtotal; }
|
||||
inline double GetFactorSD(void) { return FGCoefficient::GetSD(); }
|
||||
|
||||
private:
|
||||
FGFDMExec *FDMExec;
|
||||
|
@ -110,7 +110,7 @@ class FGFactorGroup: public FGCoefficient {
|
|||
string description;
|
||||
typedef vector<FGCoefficient*> CoeffArray;
|
||||
CoeffArray sum;
|
||||
float SDtotal;
|
||||
double SDtotal;
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ FGColumnVector3& FGForce::GetBodyForces(void) {
|
|||
FGMatrix33 FGForce::Transform(void) {
|
||||
switch(ttype) {
|
||||
case tWindBody:
|
||||
return fdmex->GetState()->GetTs2b(fdmex->GetTranslation()->Getalpha(),fdmex->GetTranslation()->Getbeta());
|
||||
return fdmex->GetState()->GetTs2b();
|
||||
case tLocalBody:
|
||||
return fdmex->GetState()->GetTl2b();
|
||||
case tCustom:
|
||||
|
@ -117,10 +117,10 @@ FGMatrix33 FGForce::Transform(void) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGForce::SetAnglesToBody(float broll, float bpitch, float byaw) {
|
||||
void FGForce::SetAnglesToBody(double broll, double bpitch, double byaw) {
|
||||
|
||||
if(ttype == tCustom) {
|
||||
float cp,sp,cr,sr,cy,sy;
|
||||
double cp,sp,cr,sr,cy,sy;
|
||||
|
||||
cp=cos(bpitch); sp=sin(bpitch);
|
||||
cr=cos(broll); sr=sin(broll);
|
||||
|
|
|
@ -138,7 +138,7 @@ vector vFs and need to be passed to FGForce:</p>
|
|||
|
||||
<p>Note that storing the native forces and moments outside of this class is not
|
||||
strictly necessary, overloaded SetNativeForces() and SetNativeMoments() methods
|
||||
which each accept three floats (rather than a vector) are provided and can be
|
||||
which each accept three doubles (rather than a vector) are provided and can be
|
||||
repeatedly called without incurring undue overhead. The body axes force vector
|
||||
can now be retrieved by calling:</p>
|
||||
|
||||
|
@ -227,14 +227,14 @@ public:
|
|||
|
||||
enum TransformType { tNone, tWindBody, tLocalBody, tCustom } ttype;
|
||||
|
||||
inline void SetNativeForces(float Fnx, float Fny, float Fnz) {
|
||||
inline void SetNativeForces(double Fnx, double Fny, double Fnz) {
|
||||
vFn(1)=Fnx;
|
||||
vFn(2)=Fny;
|
||||
vFn(3)=Fnz;
|
||||
}
|
||||
inline void SetNativeForces(FGColumnVector3 vv) { vFn = vv; };
|
||||
|
||||
inline void SetNativeMoments(float Ln,float Mn, float Nn) {
|
||||
inline void SetNativeMoments(double Ln,double Mn, double Nn) {
|
||||
vMn(1)=Ln;
|
||||
vMn(2)=Mn;
|
||||
vMn(3)=Nn;
|
||||
|
@ -251,14 +251,14 @@ public:
|
|||
|
||||
//point of application, JSBsim structural coords
|
||||
//(inches, x +back, y +right, z +up)
|
||||
inline void SetLocation(float x, float y, float z) {
|
||||
inline void SetLocation(double x, double y, double z) {
|
||||
vXYZn(1) = x;
|
||||
vXYZn(2) = y;
|
||||
vXYZn(3) = z;
|
||||
}
|
||||
inline void SetLocationX(float x) {vXYZn(1) = x;}
|
||||
inline void SetLocationY(float y) {vXYZn(2) = y;}
|
||||
inline void SetLocationZ(float z) {vXYZn(3) = z;}
|
||||
inline void SetLocationX(double x) {vXYZn(1) = x;}
|
||||
inline void SetLocationY(double y) {vXYZn(2) = y;}
|
||||
inline void SetLocationZ(double z) {vXYZn(3) = z;}
|
||||
inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; }
|
||||
FGColumnVector3& GetLocation(void) { return vXYZn; }
|
||||
|
||||
|
@ -269,10 +269,10 @@ public:
|
|||
//are going to get confused.
|
||||
//They are in radians.
|
||||
|
||||
void SetAnglesToBody(float broll, float bpitch, float byaw);
|
||||
void SetAnglesToBody(double broll, double bpitch, double byaw);
|
||||
inline void SetAnglesToBody(FGColumnVector3 vv) { SetAnglesToBody(vv(1), vv(2), vv(3));}
|
||||
|
||||
inline void SetSense(float x, float y, float z) { vSense(1)=x, vSense(2)=y, vSense(3)=z; }
|
||||
inline void SetSense(double x, double y, double z) { vSense(1)=x, vSense(2)=y, vSense(3)=z; }
|
||||
inline void SetSense(FGColumnVector3 vv) { vSense=vv; }
|
||||
|
||||
inline FGColumnVector3& GetSense(void) { return vSense; }
|
||||
|
|
|
@ -61,8 +61,8 @@ FGGroundReactions::FGGroundReactions(FGFDMExec* fgex) : FGModel(fgex),
|
|||
|
||||
bool FGGroundReactions::Run(void)
|
||||
{
|
||||
float steerAngle = 0.0;
|
||||
float xForces = 0.0, yForces = 0.0;
|
||||
double steerAngle = 0.0;
|
||||
double xForces = 0.0, yForces = 0.0;
|
||||
|
||||
if (!FGModel::Run()) {
|
||||
vForces.InitMatrix();
|
||||
|
@ -147,7 +147,7 @@ bool FGGroundReactions::Load(FGConfigFile* AC_cfg)
|
|||
|
||||
AC_cfg->GetNextConfigLine();
|
||||
|
||||
while ((token = AC_cfg->GetValue()) != "/UNDERCARRIAGE") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/UNDERCARRIAGE")) {
|
||||
lGear.push_back(FGLGear(AC_cfg, FDMExec));
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ FGInertial::~FGInertial(void)
|
|||
|
||||
bool FGInertial::Run(void)
|
||||
{
|
||||
float stht, ctht, sphi, cphi;
|
||||
double stht, ctht, sphi, cphi;
|
||||
|
||||
if (!FGModel::Run()) {
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
bool Run(void);
|
||||
FGColumnVector3& GetForces(void) {return vForces;}
|
||||
FGColumnVector3& GetGravity(void) {return vGravity;}
|
||||
float GetForces(int n) {return vForces(n);}
|
||||
double GetForces(int n) {return vForces(n);}
|
||||
bool LoadInertial(FGConfigFile* AC_cfg);
|
||||
double SLgravity(void) {return gAccelReference;}
|
||||
double gravity(void) {return gAccel;}
|
||||
|
|
|
@ -103,7 +103,7 @@ FGInitialCondition::~FGInitialCondition()
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetVcalibratedKtsIC(float tt) {
|
||||
void FGInitialCondition::SetVcalibratedKtsIC(double tt) {
|
||||
|
||||
if(getMachFromVcas(&mach,tt*ktstofps)) {
|
||||
//cout << "Mach: " << mach << endl;
|
||||
|
@ -121,7 +121,7 @@ void FGInitialCondition::SetVcalibratedKtsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetVequivalentKtsIC(float tt) {
|
||||
void FGInitialCondition::SetVequivalentKtsIC(double tt) {
|
||||
ve=tt*ktstofps;
|
||||
lastSpeedSet=setve;
|
||||
vt=ve*1/sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
|
||||
|
@ -131,9 +131,9 @@ void FGInitialCondition::SetVequivalentKtsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetVgroundFpsIC(float tt) {
|
||||
float ua,va,wa;
|
||||
float vxz;
|
||||
void FGInitialCondition::SetVgroundFpsIC(double tt) {
|
||||
double ua,va,wa;
|
||||
double vxz;
|
||||
|
||||
vg=tt;
|
||||
lastSpeedSet=setvg;
|
||||
|
@ -152,7 +152,7 @@ void FGInitialCondition::SetVgroundFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetVtrueFpsIC(float tt) {
|
||||
void FGInitialCondition::SetVtrueFpsIC(double tt) {
|
||||
vt=tt;
|
||||
lastSpeedSet=setvt;
|
||||
mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
|
||||
|
@ -162,7 +162,7 @@ void FGInitialCondition::SetVtrueFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetMachIC(float tt) {
|
||||
void FGInitialCondition::SetMachIC(double tt) {
|
||||
mach=tt;
|
||||
lastSpeedSet=setmach;
|
||||
vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
|
||||
|
@ -173,13 +173,13 @@ void FGInitialCondition::SetMachIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetClimbRateFpmIC(float tt) {
|
||||
void FGInitialCondition::SetClimbRateFpmIC(double tt) {
|
||||
SetClimbRateFpsIC(tt/60.0);
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetClimbRateFpsIC(float tt) {
|
||||
void FGInitialCondition::SetClimbRateFpsIC(double tt) {
|
||||
|
||||
if(vt > 0.1) {
|
||||
hdot=tt;
|
||||
|
@ -190,7 +190,7 @@ void FGInitialCondition::SetClimbRateFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetFlightPathAngleRadIC(float tt) {
|
||||
void FGInitialCondition::SetFlightPathAngleRadIC(double tt) {
|
||||
gamma=tt;
|
||||
sgamma=sin(gamma); cgamma=cos(gamma);
|
||||
getTheta();
|
||||
|
@ -199,7 +199,7 @@ void FGInitialCondition::SetFlightPathAngleRadIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetAlphaRadIC(float tt) {
|
||||
void FGInitialCondition::SetAlphaRadIC(double tt) {
|
||||
alpha=tt;
|
||||
salpha=sin(alpha); calpha=cos(alpha);
|
||||
getTheta();
|
||||
|
@ -207,7 +207,7 @@ void FGInitialCondition::SetAlphaRadIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetPitchAngleRadIC(float tt) {
|
||||
void FGInitialCondition::SetPitchAngleRadIC(double tt) {
|
||||
theta=tt;
|
||||
stheta=sin(theta); ctheta=cos(theta);
|
||||
getAlpha();
|
||||
|
@ -215,7 +215,7 @@ void FGInitialCondition::SetPitchAngleRadIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetBetaRadIC(float tt) {
|
||||
void FGInitialCondition::SetBetaRadIC(double tt) {
|
||||
beta=tt;
|
||||
sbeta=sin(beta); cbeta=cos(beta);
|
||||
getTheta();
|
||||
|
@ -224,7 +224,7 @@ void FGInitialCondition::SetBetaRadIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetRollAngleRadIC(float tt) {
|
||||
void FGInitialCondition::SetRollAngleRadIC(double tt) {
|
||||
phi=tt;
|
||||
sphi=sin(phi); cphi=cos(phi);
|
||||
getTheta();
|
||||
|
@ -232,7 +232,7 @@ void FGInitialCondition::SetRollAngleRadIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetTrueHeadingRadIC(float tt) {
|
||||
void FGInitialCondition::SetTrueHeadingRadIC(double tt) {
|
||||
psi=tt;
|
||||
spsi=sin(psi); cpsi=cos(psi);
|
||||
calcWindUVW();
|
||||
|
@ -240,7 +240,7 @@ void FGInitialCondition::SetTrueHeadingRadIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetUBodyFpsIC(float tt) {
|
||||
void FGInitialCondition::SetUBodyFpsIC(double tt) {
|
||||
u=tt;
|
||||
vt=sqrt(u*u + v*v + w*w);
|
||||
lastSpeedSet=setuvw;
|
||||
|
@ -248,7 +248,7 @@ void FGInitialCondition::SetUBodyFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetVBodyFpsIC(float tt) {
|
||||
void FGInitialCondition::SetVBodyFpsIC(double tt) {
|
||||
v=tt;
|
||||
vt=sqrt(u*u + v*v + w*w);
|
||||
lastSpeedSet=setuvw;
|
||||
|
@ -256,7 +256,7 @@ void FGInitialCondition::SetVBodyFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetWBodyFpsIC(float tt) {
|
||||
void FGInitialCondition::SetWBodyFpsIC(double tt) {
|
||||
w=tt;
|
||||
vt=sqrt( u*u + v*v + w*w );
|
||||
lastSpeedSet=setuvw;
|
||||
|
@ -264,7 +264,7 @@ void FGInitialCondition::SetWBodyFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
float FGInitialCondition::GetUBodyFpsIC(void) {
|
||||
double FGInitialCondition::GetUBodyFpsIC(void) {
|
||||
if(lastSpeedSet == setvg )
|
||||
return u;
|
||||
else
|
||||
|
@ -273,7 +273,7 @@ float FGInitialCondition::GetUBodyFpsIC(void) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
float FGInitialCondition::GetVBodyFpsIC(void) {
|
||||
double FGInitialCondition::GetVBodyFpsIC(void) {
|
||||
if( lastSpeedSet == setvg )
|
||||
return v;
|
||||
else {
|
||||
|
@ -283,7 +283,7 @@ float FGInitialCondition::GetVBodyFpsIC(void) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
float FGInitialCondition::GetWBodyFpsIC(void) {
|
||||
double FGInitialCondition::GetWBodyFpsIC(void) {
|
||||
if( lastSpeedSet == setvg )
|
||||
return w;
|
||||
else
|
||||
|
@ -292,7 +292,7 @@ float FGInitialCondition::GetWBodyFpsIC(void) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetWindNEDFpsIC(float wN, float wE, float wD ) {
|
||||
void FGInitialCondition::SetWindNEDFpsIC(double wN, double wE, double wD ) {
|
||||
wnorth = wN; weast = wE; wdown = wD;
|
||||
lastWindSet = setwned;
|
||||
calcWindUVW();
|
||||
|
@ -303,7 +303,7 @@ void FGInitialCondition::SetWindNEDFpsIC(float wN, float wE, float wD ) {
|
|||
//******************************************************************************
|
||||
|
||||
// positive from left
|
||||
void FGInitialCondition::SetHeadWindKtsIC(float head){
|
||||
void FGInitialCondition::SetHeadWindKtsIC(double head){
|
||||
whead=head*ktstofps;
|
||||
lastWindSet=setwhc;
|
||||
calcWindUVW();
|
||||
|
@ -314,7 +314,7 @@ void FGInitialCondition::SetHeadWindKtsIC(float head){
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetCrossWindKtsIC(float cross){
|
||||
void FGInitialCondition::SetCrossWindKtsIC(double cross){
|
||||
wcross=cross*ktstofps;
|
||||
lastWindSet=setwhc;
|
||||
calcWindUVW();
|
||||
|
@ -325,7 +325,7 @@ void FGInitialCondition::SetCrossWindKtsIC(float cross){
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetWindDownKtsIC(float wD) {
|
||||
void FGInitialCondition::SetWindDownKtsIC(double wD) {
|
||||
wdown=wD;
|
||||
calcWindUVW();
|
||||
if(lastSpeedSet == setvg)
|
||||
|
@ -334,7 +334,7 @@ void FGInitialCondition::SetWindDownKtsIC(float wD) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetWindMagKtsIC(float mag) {
|
||||
void FGInitialCondition::SetWindMagKtsIC(double mag) {
|
||||
wmag=mag*ktstofps;
|
||||
lastWindSet=setwmd;
|
||||
calcWindUVW();
|
||||
|
@ -344,7 +344,7 @@ void FGInitialCondition::SetWindMagKtsIC(float mag) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetWindDirDegIC(float dir) {
|
||||
void FGInitialCondition::SetWindDirDegIC(double dir) {
|
||||
wdir=dir*degtorad;
|
||||
lastWindSet=setwmd;
|
||||
calcWindUVW();
|
||||
|
@ -389,7 +389,7 @@ void FGInitialCondition::calcWindUVW(void) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetAltitudeFtIC(float tt) {
|
||||
void FGInitialCondition::SetAltitudeFtIC(double tt) {
|
||||
altitude=tt;
|
||||
fdmex->GetPosition()->Seth(altitude);
|
||||
fdmex->GetAtmosphere()->Run();
|
||||
|
@ -418,7 +418,7 @@ void FGInitialCondition::SetAltitudeFtIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetAltitudeAGLFtIC(float tt) {
|
||||
void FGInitialCondition::SetAltitudeAGLFtIC(double tt) {
|
||||
fdmex->GetPosition()->SetDistanceAGL(tt);
|
||||
altitude=fdmex->GetPosition()->Geth();
|
||||
SetAltitudeFtIC(altitude);
|
||||
|
@ -452,7 +452,7 @@ void FGInitialCondition::calcUVWfromNED(void) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetVnorthFpsIC(float tt) {
|
||||
void FGInitialCondition::SetVnorthFpsIC(double tt) {
|
||||
vnorth=tt;
|
||||
calcUVWfromNED();
|
||||
vt=sqrt(u*u + v*v + w*w);
|
||||
|
@ -461,7 +461,7 @@ void FGInitialCondition::SetVnorthFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetVeastFpsIC(float tt) {
|
||||
void FGInitialCondition::SetVeastFpsIC(double tt) {
|
||||
veast=tt;
|
||||
calcUVWfromNED();
|
||||
vt=sqrt(u*u + v*v + w*w);
|
||||
|
@ -470,7 +470,7 @@ void FGInitialCondition::SetVeastFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
void FGInitialCondition::SetVdownFpsIC(float tt) {
|
||||
void FGInitialCondition::SetVdownFpsIC(double tt) {
|
||||
vdown=tt;
|
||||
calcUVWfromNED();
|
||||
vt=sqrt(u*u + v*v + w*w);
|
||||
|
@ -480,10 +480,10 @@ void FGInitialCondition::SetVdownFpsIC(float tt) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
bool FGInitialCondition::getMachFromVcas(float *Mach,float vcas) {
|
||||
bool FGInitialCondition::getMachFromVcas(double *Mach,double vcas) {
|
||||
|
||||
bool result=false;
|
||||
float guess=1.5;
|
||||
double guess=1.5;
|
||||
xlo=xhi=0;
|
||||
xmin=0;xmax=50;
|
||||
sfunc=&FGInitialCondition::calcVcas;
|
||||
|
@ -498,7 +498,7 @@ bool FGInitialCondition::getMachFromVcas(float *Mach,float vcas) {
|
|||
|
||||
bool FGInitialCondition::getAlpha(void) {
|
||||
bool result=false;
|
||||
float guess=theta-gamma;
|
||||
double guess=theta-gamma;
|
||||
xlo=xhi=0;
|
||||
xmin=fdmex->GetAircraft()->GetAlphaCLMin();
|
||||
xmax=fdmex->GetAircraft()->GetAlphaCLMax();
|
||||
|
@ -518,7 +518,7 @@ bool FGInitialCondition::getAlpha(void) {
|
|||
|
||||
bool FGInitialCondition::getTheta(void) {
|
||||
bool result=false;
|
||||
float guess=alpha+gamma;
|
||||
double guess=alpha+gamma;
|
||||
xlo=xhi=0;
|
||||
xmin=-89;xmax=89;
|
||||
sfunc=&FGInitialCondition::GammaEqOfTheta;
|
||||
|
@ -535,9 +535,9 @@ bool FGInitialCondition::getTheta(void) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
float FGInitialCondition::GammaEqOfTheta(float Theta) {
|
||||
float a,b,c,d;
|
||||
float sTheta,cTheta;
|
||||
double FGInitialCondition::GammaEqOfTheta(double Theta) {
|
||||
double a,b,c,d;
|
||||
double sTheta,cTheta;
|
||||
|
||||
//theta=Theta; stheta=sin(theta); ctheta=cos(theta);
|
||||
sTheta=sin(Theta); cTheta=cos(Theta);
|
||||
|
@ -550,9 +550,9 @@ float FGInitialCondition::GammaEqOfTheta(float Theta) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
float FGInitialCondition::GammaEqOfAlpha(float Alpha) {
|
||||
float a,b,c,d;
|
||||
float sAlpha,cAlpha;
|
||||
double FGInitialCondition::GammaEqOfAlpha(double Alpha) {
|
||||
double a,b,c,d;
|
||||
double sAlpha,cAlpha;
|
||||
|
||||
sAlpha=sin(Alpha); cAlpha=cos(Alpha);
|
||||
a=wdown + vt*cAlpha*cbeta + uw;
|
||||
|
@ -564,12 +564,12 @@ float FGInitialCondition::GammaEqOfAlpha(float Alpha) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
float FGInitialCondition::calcVcas(float Mach) {
|
||||
double FGInitialCondition::calcVcas(double Mach) {
|
||||
|
||||
float p=fdmex->GetAtmosphere()->GetPressure();
|
||||
float psl=fdmex->GetAtmosphere()->GetPressureSL();
|
||||
float rhosl=fdmex->GetAtmosphere()->GetDensitySL();
|
||||
float pt,A,B,D,vcas;
|
||||
double p=fdmex->GetAtmosphere()->GetPressure();
|
||||
double psl=fdmex->GetAtmosphere()->GetPressureSL();
|
||||
double rhosl=fdmex->GetAtmosphere()->GetDensitySL();
|
||||
double pt,A,B,D,vcas;
|
||||
if(Mach < 0) Mach=0;
|
||||
if(Mach < 1) //calculate total pressure assuming isentropic flow
|
||||
pt=p*pow((1 + 0.2*Mach*Mach),3.5);
|
||||
|
@ -605,13 +605,13 @@ float FGInitialCondition::calcVcas(float Mach) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
bool FGInitialCondition::findInterval(float x,float guess) {
|
||||
//void find_interval(inter_params &ip,eqfunc f,float y,float constant, int &flag){
|
||||
bool FGInitialCondition::findInterval(double x,double guess) {
|
||||
//void find_interval(inter_params &ip,eqfunc f,double y,double constant, int &flag){
|
||||
|
||||
int i=0;
|
||||
bool found=false;
|
||||
float flo,fhi,fguess;
|
||||
float lo,hi,step;
|
||||
double flo,fhi,fguess;
|
||||
double lo,hi,step;
|
||||
step=0.1;
|
||||
fguess=(this->*sfunc)(guess)-x;
|
||||
lo=hi=guess;
|
||||
|
@ -644,11 +644,11 @@ bool FGInitialCondition::findInterval(float x,float guess) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
bool FGInitialCondition::solve(float *y,float x)
|
||||
bool FGInitialCondition::solve(double *y,double x)
|
||||
{
|
||||
float x1,x2,x3,f1,f2,f3,d,d0;
|
||||
float eps=1E-5;
|
||||
float const relax =0.9;
|
||||
double x1,x2,x3,f1,f2,f3,d,d0;
|
||||
double eps=1E-5;
|
||||
double const relax =0.9;
|
||||
int i;
|
||||
bool success=false;
|
||||
|
||||
|
@ -695,7 +695,7 @@ bool FGInitialCondition::solve(float *y,float x)
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
float FGInitialCondition::GetWindDirDegIC(void) {
|
||||
double FGInitialCondition::GetWindDirDegIC(void) {
|
||||
if(weast != 0.0)
|
||||
return atan2(weast,wnorth)*radtodeg;
|
||||
else if(wnorth > 0)
|
||||
|
@ -706,26 +706,25 @@ float FGInitialCondition::GetWindDirDegIC(void) {
|
|||
|
||||
//******************************************************************************
|
||||
|
||||
bool FGInitialCondition::Load(string path, string acname, string fname)
|
||||
bool FGInitialCondition::Load(string acpath, string acname, string rstfile)
|
||||
{
|
||||
string resetDef;
|
||||
string token="";
|
||||
|
||||
float temp;
|
||||
double temp;
|
||||
|
||||
# ifndef macintosh
|
||||
resetDef = path + "/" + acname + "/" + fname + ".xml";
|
||||
resetDef = acpath + "/" + acname + "/" + rstfile + ".xml";
|
||||
# else
|
||||
resetDef = path + ";" + acname + ";" + fname + ".xml";
|
||||
resetDef = acpath + ";" + acname + ";" + rstfile + ".xml";
|
||||
# endif
|
||||
|
||||
cout << resetDef << endl;
|
||||
FGConfigFile resetfile(resetDef);
|
||||
if (!resetfile.IsOpen()) return false;
|
||||
|
||||
resetfile.GetNextConfigLine();
|
||||
token = resetfile.GetValue();
|
||||
if (token != "initialize") {
|
||||
if (token != string("initialize")) {
|
||||
cerr << "The reset file " << resetDef
|
||||
<< " does not appear to be a reset file" << endl;
|
||||
return false;
|
||||
|
@ -733,7 +732,7 @@ bool FGInitialCondition::Load(string path, string acname, string fname)
|
|||
|
||||
resetfile.GetNextConfigLine();
|
||||
resetfile >> token;
|
||||
while (token != "/initialize" && token != "EOF") {
|
||||
while (token != string("/initialize") && token != string("EOF")) {
|
||||
if (token == "UBODY" ) { resetfile >> temp; SetUBodyFpsIC(temp); }
|
||||
if (token == "VBODY" ) { resetfile >> temp; SetVBodyFpsIC(temp); }
|
||||
if (token == "WBODY" ) { resetfile >> temp; SetWBodyFpsIC(temp); }
|
||||
|
|
|
@ -140,137 +140,137 @@ public:
|
|||
/// Destructor
|
||||
~FGInitialCondition();
|
||||
|
||||
void SetVcalibratedKtsIC(float tt);
|
||||
void SetVequivalentKtsIC(float tt);
|
||||
inline void SetVtrueKtsIC(float tt) { SetVtrueFpsIC(tt*ktstofps); }
|
||||
inline void SetVgroundKtsIC(float tt) { SetVgroundFpsIC(tt*ktstofps); }
|
||||
void SetMachIC(float tt);
|
||||
void SetVcalibratedKtsIC(double tt);
|
||||
void SetVequivalentKtsIC(double tt);
|
||||
inline void SetVtrueKtsIC(double tt) { SetVtrueFpsIC(tt*ktstofps); }
|
||||
inline void SetVgroundKtsIC(double tt) { SetVgroundFpsIC(tt*ktstofps); }
|
||||
void SetMachIC(double tt);
|
||||
|
||||
inline void SetAlphaDegIC(float tt) { SetAlphaRadIC(tt*degtorad); }
|
||||
inline void SetBetaDegIC(float tt) { SetBetaRadIC(tt*degtorad);}
|
||||
inline void SetAlphaDegIC(double tt) { SetAlphaRadIC(tt*degtorad); }
|
||||
inline void SetBetaDegIC(double tt) { SetBetaRadIC(tt*degtorad);}
|
||||
|
||||
inline void SetPitchAngleDegIC(float tt) { SetPitchAngleRadIC(tt*degtorad); }
|
||||
inline void SetRollAngleDegIC(float tt) { SetRollAngleRadIC(tt*degtorad);}
|
||||
inline void SetTrueHeadingDegIC(float tt){ SetTrueHeadingRadIC(tt*degtorad); }
|
||||
inline void SetPitchAngleDegIC(double tt) { SetPitchAngleRadIC(tt*degtorad); }
|
||||
inline void SetRollAngleDegIC(double tt) { SetRollAngleRadIC(tt*degtorad);}
|
||||
inline void SetTrueHeadingDegIC(double tt){ SetTrueHeadingRadIC(tt*degtorad); }
|
||||
|
||||
void SetClimbRateFpmIC(float tt);
|
||||
inline void SetFlightPathAngleDegIC(float tt) { SetFlightPathAngleRadIC(tt*degtorad); }
|
||||
void SetClimbRateFpmIC(double tt);
|
||||
inline void SetFlightPathAngleDegIC(double tt) { SetFlightPathAngleRadIC(tt*degtorad); }
|
||||
|
||||
void SetAltitudeFtIC(float tt);
|
||||
void SetAltitudeAGLFtIC(float tt);
|
||||
void SetAltitudeFtIC(double tt);
|
||||
void SetAltitudeAGLFtIC(double tt);
|
||||
|
||||
void SetSeaLevelRadiusFtIC(double tt);
|
||||
void SetTerrainAltitudeFtIC(double tt);
|
||||
|
||||
inline void SetLatitudeDegIC(float tt) { latitude=tt*degtorad; }
|
||||
inline void SetLongitudeDegIC(float tt) { longitude=tt*degtorad; }
|
||||
inline void SetLatitudeDegIC(double tt) { latitude=tt*degtorad; }
|
||||
inline void SetLongitudeDegIC(double tt) { longitude=tt*degtorad; }
|
||||
|
||||
|
||||
inline float GetVcalibratedKtsIC(void) { return vc*fpstokts; }
|
||||
inline float GetVequivalentKtsIC(void) { return ve*fpstokts; }
|
||||
inline float GetVgroundKtsIC(void) { return vg*fpstokts; }
|
||||
inline float GetVtrueKtsIC(void) { return vt*fpstokts; }
|
||||
inline float GetMachIC(void) { return mach; }
|
||||
inline double GetVcalibratedKtsIC(void) { return vc*fpstokts; }
|
||||
inline double GetVequivalentKtsIC(void) { return ve*fpstokts; }
|
||||
inline double GetVgroundKtsIC(void) { return vg*fpstokts; }
|
||||
inline double GetVtrueKtsIC(void) { return vt*fpstokts; }
|
||||
inline double GetMachIC(void) { return mach; }
|
||||
|
||||
inline float GetClimbRateFpmIC(void) { return hdot*60; }
|
||||
inline float GetFlightPathAngleDegIC(void) { return gamma*radtodeg; }
|
||||
inline double GetClimbRateFpmIC(void) { return hdot*60; }
|
||||
inline double GetFlightPathAngleDegIC(void) { return gamma*radtodeg; }
|
||||
|
||||
inline float GetAlphaDegIC(void) { return alpha*radtodeg; }
|
||||
inline float GetBetaDegIC(void) { return beta*radtodeg; }
|
||||
inline double GetAlphaDegIC(void) { return alpha*radtodeg; }
|
||||
inline double GetBetaDegIC(void) { return beta*radtodeg; }
|
||||
|
||||
inline float GetPitchAngleDegIC(void) { return theta*radtodeg; }
|
||||
inline float GetRollAngleDegIC(void) { return phi*radtodeg; }
|
||||
inline float GetHeadingDegIC(void) { return psi*radtodeg; }
|
||||
inline double GetPitchAngleDegIC(void) { return theta*radtodeg; }
|
||||
inline double GetRollAngleDegIC(void) { return phi*radtodeg; }
|
||||
inline double GetHeadingDegIC(void) { return psi*radtodeg; }
|
||||
|
||||
inline float GetLatitudeDegIC(void) { return latitude*radtodeg; }
|
||||
inline float GetLongitudeDegIC(void) { return longitude*radtodeg; }
|
||||
inline double GetLatitudeDegIC(void) { return latitude*radtodeg; }
|
||||
inline double GetLongitudeDegIC(void) { return longitude*radtodeg; }
|
||||
|
||||
inline float GetAltitudeFtIC(void) { return altitude; }
|
||||
inline float GetAltitudeAGLFtIC(void) { return altitude - terrain_altitude; }
|
||||
inline double GetAltitudeFtIC(void) { return altitude; }
|
||||
inline double GetAltitudeAGLFtIC(void) { return altitude - terrain_altitude; }
|
||||
|
||||
inline float GetSeaLevelRadiusFtIC(void) { return sea_level_radius; }
|
||||
inline float GetTerrainAltitudeFtIC(void) { return terrain_altitude; }
|
||||
inline double GetSeaLevelRadiusFtIC(void) { return sea_level_radius; }
|
||||
inline double GetTerrainAltitudeFtIC(void) { return terrain_altitude; }
|
||||
|
||||
void SetVgroundFpsIC(float tt);
|
||||
void SetVtrueFpsIC(float tt);
|
||||
void SetUBodyFpsIC(float tt);
|
||||
void SetVBodyFpsIC(float tt);
|
||||
void SetWBodyFpsIC(float tt);
|
||||
void SetVnorthFpsIC(float tt);
|
||||
void SetVeastFpsIC(float tt);
|
||||
void SetVdownFpsIC(float tt);
|
||||
void SetVgroundFpsIC(double tt);
|
||||
void SetVtrueFpsIC(double tt);
|
||||
void SetUBodyFpsIC(double tt);
|
||||
void SetVBodyFpsIC(double tt);
|
||||
void SetWBodyFpsIC(double tt);
|
||||
void SetVnorthFpsIC(double tt);
|
||||
void SetVeastFpsIC(double tt);
|
||||
void SetVdownFpsIC(double tt);
|
||||
|
||||
void SetWindNEDFpsIC(float wN, float wE, float wD);
|
||||
void SetWindNEDFpsIC(double wN, double wE, double wD);
|
||||
|
||||
void SetWindMagKtsIC(float mag);
|
||||
void SetWindDirDegIC(float dir);
|
||||
void SetWindMagKtsIC(double mag);
|
||||
void SetWindDirDegIC(double dir);
|
||||
|
||||
void SetHeadWindKtsIC(float head);
|
||||
void SetCrossWindKtsIC(float cross);// positive from left
|
||||
void SetHeadWindKtsIC(double head);
|
||||
void SetCrossWindKtsIC(double cross);// positive from left
|
||||
|
||||
void SetWindDownKtsIC(float wD);
|
||||
void SetWindDownKtsIC(double wD);
|
||||
|
||||
void SetClimbRateFpsIC(float tt);
|
||||
inline float GetVgroundFpsIC(void) { return vg; }
|
||||
inline float GetVtrueFpsIC(void) { return vt; }
|
||||
inline float GetWindUFpsIC(void) { return uw; }
|
||||
inline float GetWindVFpsIC(void) { return vw; }
|
||||
inline float GetWindWFpsIC(void) { return ww; }
|
||||
inline float GetWindNFpsIC(void) { return wnorth; }
|
||||
inline float GetWindEFpsIC(void) { return weast; }
|
||||
inline float GetWindDFpsIC(void) { return wdown; }
|
||||
inline float GetWindFpsIC(void) { return sqrt(wnorth*wnorth + weast*weast); }
|
||||
float GetWindDirDegIC(void);
|
||||
inline float GetClimbRateFpsIC(void) { return hdot; }
|
||||
float GetUBodyFpsIC(void);
|
||||
float GetVBodyFpsIC(void);
|
||||
float GetWBodyFpsIC(void);
|
||||
void SetFlightPathAngleRadIC(float tt);
|
||||
void SetAlphaRadIC(float tt);
|
||||
void SetPitchAngleRadIC(float tt);
|
||||
void SetBetaRadIC(float tt);
|
||||
void SetRollAngleRadIC(float tt);
|
||||
void SetTrueHeadingRadIC(float tt);
|
||||
inline void SetLatitudeRadIC(float tt) { latitude=tt; }
|
||||
inline void SetLongitudeRadIC(float tt) { longitude=tt; }
|
||||
inline float GetFlightPathAngleRadIC(void) { return gamma; }
|
||||
inline float GetAlphaRadIC(void) { return alpha; }
|
||||
inline float GetPitchAngleRadIC(void) { return theta; }
|
||||
inline float GetBetaRadIC(void) { return beta; }
|
||||
inline float GetRollAngleRadIC(void) { return phi; }
|
||||
inline float GetHeadingRadIC(void) { return psi; }
|
||||
inline float GetLatitudeRadIC(void) { return latitude; }
|
||||
inline float GetLongitudeRadIC(void) { return longitude; }
|
||||
inline float GetThetaRadIC(void) { return theta; }
|
||||
inline float GetPhiRadIC(void) { return phi; }
|
||||
inline float GetPsiRadIC(void) { return psi; }
|
||||
void SetClimbRateFpsIC(double tt);
|
||||
inline double GetVgroundFpsIC(void) { return vg; }
|
||||
inline double GetVtrueFpsIC(void) { return vt; }
|
||||
inline double GetWindUFpsIC(void) { return uw; }
|
||||
inline double GetWindVFpsIC(void) { return vw; }
|
||||
inline double GetWindWFpsIC(void) { return ww; }
|
||||
inline double GetWindNFpsIC(void) { return wnorth; }
|
||||
inline double GetWindEFpsIC(void) { return weast; }
|
||||
inline double GetWindDFpsIC(void) { return wdown; }
|
||||
inline double GetWindFpsIC(void) { return sqrt(wnorth*wnorth + weast*weast); }
|
||||
double GetWindDirDegIC(void);
|
||||
inline double GetClimbRateFpsIC(void) { return hdot; }
|
||||
double GetUBodyFpsIC(void);
|
||||
double GetVBodyFpsIC(void);
|
||||
double GetWBodyFpsIC(void);
|
||||
void SetFlightPathAngleRadIC(double tt);
|
||||
void SetAlphaRadIC(double tt);
|
||||
void SetPitchAngleRadIC(double tt);
|
||||
void SetBetaRadIC(double tt);
|
||||
void SetRollAngleRadIC(double tt);
|
||||
void SetTrueHeadingRadIC(double tt);
|
||||
inline void SetLatitudeRadIC(double tt) { latitude=tt; }
|
||||
inline void SetLongitudeRadIC(double tt) { longitude=tt; }
|
||||
inline double GetFlightPathAngleRadIC(void) { return gamma; }
|
||||
inline double GetAlphaRadIC(void) { return alpha; }
|
||||
inline double GetPitchAngleRadIC(void) { return theta; }
|
||||
inline double GetBetaRadIC(void) { return beta; }
|
||||
inline double GetRollAngleRadIC(void) { return phi; }
|
||||
inline double GetHeadingRadIC(void) { return psi; }
|
||||
inline double GetLatitudeRadIC(void) { return latitude; }
|
||||
inline double GetLongitudeRadIC(void) { return longitude; }
|
||||
inline double GetThetaRadIC(void) { return theta; }
|
||||
inline double GetPhiRadIC(void) { return phi; }
|
||||
inline double GetPsiRadIC(void) { return psi; }
|
||||
|
||||
inline speedset GetSpeedSet(void) { return lastSpeedSet; }
|
||||
inline windset GetWindSet(void) { return lastWindSet; }
|
||||
|
||||
bool Load(string path, string acname, string fname);
|
||||
bool Load(string acpath, string acname, string rstname);
|
||||
|
||||
private:
|
||||
float vt,vc,ve,vg;
|
||||
float mach;
|
||||
float altitude,hdot;
|
||||
float latitude,longitude;
|
||||
float u,v,w;
|
||||
float uw,vw,ww;
|
||||
float vnorth,veast,vdown;
|
||||
float wnorth,weast,wdown;
|
||||
float whead, wcross, wdir, wmag;
|
||||
double vt,vc,ve,vg;
|
||||
double mach;
|
||||
double altitude,hdot;
|
||||
double latitude,longitude;
|
||||
double u,v,w;
|
||||
double uw,vw,ww;
|
||||
double vnorth,veast,vdown;
|
||||
double wnorth,weast,wdown;
|
||||
double whead, wcross, wdir, wmag;
|
||||
double sea_level_radius;
|
||||
double terrain_altitude;
|
||||
double radius_to_vehicle;
|
||||
|
||||
float alpha, beta, theta, phi, psi, gamma;
|
||||
float salpha,sbeta,stheta,sphi,spsi,sgamma;
|
||||
float calpha,cbeta,ctheta,cphi,cpsi,cgamma;
|
||||
double alpha, beta, theta, phi, psi, gamma;
|
||||
double salpha,sbeta,stheta,sphi,spsi,sgamma;
|
||||
double calpha,cbeta,ctheta,cphi,cpsi,cgamma;
|
||||
|
||||
float xlo, xhi,xmin,xmax;
|
||||
double xlo, xhi,xmin,xmax;
|
||||
|
||||
typedef float (FGInitialCondition::*fp)(float x);
|
||||
typedef double (FGInitialCondition::*fp)(double x);
|
||||
fp sfunc;
|
||||
|
||||
speedset lastSpeedSet;
|
||||
|
@ -280,16 +280,16 @@ private:
|
|||
|
||||
bool getAlpha(void);
|
||||
bool getTheta(void);
|
||||
bool getMachFromVcas(float *Mach,float vcas);
|
||||
bool getMachFromVcas(double *Mach,double vcas);
|
||||
|
||||
float GammaEqOfTheta(float Theta);
|
||||
float GammaEqOfAlpha(float Alpha);
|
||||
float calcVcas(float Mach);
|
||||
double GammaEqOfTheta(double Theta);
|
||||
double GammaEqOfAlpha(double Alpha);
|
||||
double calcVcas(double Mach);
|
||||
void calcUVWfromNED(void);
|
||||
void calcWindUVW(void);
|
||||
|
||||
bool findInterval(float x,float guess);
|
||||
bool solve(float *y, float x);
|
||||
bool findInterval(double x,double guess);
|
||||
bool solve(double *y, double x);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -43,17 +43,22 @@ INCLUDES
|
|||
# include <math.h>
|
||||
# include <queue>
|
||||
# include STL_STRING
|
||||
SG_USING_STD(queue);
|
||||
|
||||
SG_USING_STD(string);
|
||||
SG_USING_STD(queue);
|
||||
|
||||
#else
|
||||
|
||||
# include <queue>
|
||||
# include <string>
|
||||
# if defined(sgi) && !defined(__GNUC__)
|
||||
# include <math.h>
|
||||
# include <queue.h>
|
||||
# include <string.h>
|
||||
# else
|
||||
# include <cmath>
|
||||
# include <queue>
|
||||
# include <string>
|
||||
# endif
|
||||
|
||||
using std::string;
|
||||
using std::queue;
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
|
|
|
@ -112,7 +112,7 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : vXYZ(3),
|
|||
FCS = Exec->GetFCS();
|
||||
MassBalance = Exec->GetMassBalance();
|
||||
|
||||
WOW = false;
|
||||
WOW = lastWOW = false;
|
||||
ReportEnable = true;
|
||||
FirstContact = false;
|
||||
Reported = false;
|
||||
|
@ -147,6 +147,7 @@ FGLGear::FGLGear(const FGLGear& lgear)
|
|||
vLocalGear = lgear.vLocalGear;
|
||||
|
||||
WOW = lgear.WOW;
|
||||
lastWOW = lgear.lastWOW;
|
||||
ReportEnable = lgear.ReportEnable;
|
||||
FirstContact = lgear.FirstContact;
|
||||
DistanceTraveled = lgear.DistanceTraveled;
|
||||
|
@ -184,10 +185,10 @@ FGLGear::~FGLGear()
|
|||
|
||||
FGColumnVector3& FGLGear::Force(void)
|
||||
{
|
||||
float SteerGain;
|
||||
float SinWheel, CosWheel, SideWhlVel, RollingWhlVel;
|
||||
float RudderPedal, RollingForce, SideForce, FCoeff;
|
||||
float WheelSlip;
|
||||
double SteerGain;
|
||||
double SinWheel, CosWheel, SideWhlVel, RollingWhlVel;
|
||||
double RudderPedal, RollingForce, SideForce, FCoeff;
|
||||
double WheelSlip;
|
||||
|
||||
vWhlBodyVec = (vXYZ - MassBalance->GetXYZcg()) / 12.0;
|
||||
vWhlBodyVec(eX) = -vWhlBodyVec(eX);
|
||||
|
@ -337,7 +338,7 @@ FGColumnVector3& FGLGear::Force(void)
|
|||
// case. NOTE: SQUARE LAW DAMPING NO GOOD!
|
||||
|
||||
vLocalForce(eZ) = min(-compressLength * kSpring
|
||||
- compressSpeed * bDamp, (float)0.0);
|
||||
- compressSpeed * bDamp, (double)0.0);
|
||||
|
||||
MaximumStrutForce = max(MaximumStrutForce, fabs(vLocalForce(eZ)));
|
||||
MaximumStrutTravel = max(MaximumStrutTravel, fabs(compressLength));
|
||||
|
@ -397,6 +398,23 @@ FGColumnVector3& FGLGear::Force(void)
|
|||
if (debug_lvl > 0) Report();
|
||||
}
|
||||
|
||||
if (lastWOW != WOW) {
|
||||
PutMessage("GEAR_CONTACT", WOW);
|
||||
}
|
||||
|
||||
lastWOW = WOW;
|
||||
|
||||
// Crash detection logic (really out-of-bounds detection)
|
||||
|
||||
if (compressLength > 500.0 ||
|
||||
vForce.Magnitude() > 100000000.0 ||
|
||||
vMoment.Magnitude() > 5000000000.0 ||
|
||||
SinkRate > 1.4666*30)
|
||||
{
|
||||
PutMessage("Crash Detected");
|
||||
Exec->Freeze();
|
||||
}
|
||||
|
||||
return vForce;
|
||||
}
|
||||
|
||||
|
|
|
@ -200,22 +200,22 @@ public:
|
|||
|
||||
/// Gets the location of the gear in Body axes
|
||||
FGColumnVector3& GetBodyLocation(void) { return vWhlBodyVec; }
|
||||
float GetBodyLocation(int idx) { return vWhlBodyVec(idx); }
|
||||
double GetBodyLocation(int idx) { return vWhlBodyVec(idx); }
|
||||
|
||||
FGColumnVector3& GetLocalGear(void) { return vLocalGear; }
|
||||
float GetLocalGear(int idx) { return vLocalGear(idx); }
|
||||
double GetLocalGear(int idx) { return vLocalGear(idx); }
|
||||
|
||||
/// Gets the name of the gear
|
||||
inline string GetName(void) {return name; }
|
||||
/// Gets the Weight On Wheels flag value
|
||||
inline bool GetWOW(void) {return WOW; }
|
||||
/// Gets the current compressed length of the gear in feet
|
||||
inline float GetCompLen(void) {return compressLength;}
|
||||
inline double GetCompLen(void) {return compressLength;}
|
||||
/// Gets the current gear compression velocity in ft/sec
|
||||
inline float GetCompVel(void) {return compressSpeed; }
|
||||
inline double GetCompVel(void) {return compressSpeed; }
|
||||
/// Gets the gear compression force in pounds
|
||||
inline float GetCompForce(void) {return Force()(3); }
|
||||
inline float GetBrakeFCoeff(void) {return BrakeFCoeff;}
|
||||
inline double GetCompForce(void) {return Force()(3); }
|
||||
inline double GetBrakeFCoeff(void) {return BrakeFCoeff;}
|
||||
|
||||
/// Sets the brake value in percent (0 - 100)
|
||||
inline void SetBrake(double bp) {brakePct = bp;}
|
||||
|
@ -226,8 +226,8 @@ public:
|
|||
/** Get the console touchdown reporting feature
|
||||
@return true if reporting is turned on */
|
||||
inline bool GetReport(void) { return ReportEnable; }
|
||||
inline float GetSteerAngle(void) { return SteerAngle;}
|
||||
inline float GetstaticFCoeff(void) { return staticFCoeff;}
|
||||
inline double GetSteerAngle(void) { return SteerAngle;}
|
||||
inline double GetstaticFCoeff(void) { return staticFCoeff;}
|
||||
|
||||
inline int GetBrakeGroup(void) { return (int)eBrakeGrp; }
|
||||
inline int GetSteerType(void) { return (int)eSteerType; }
|
||||
|
@ -240,21 +240,22 @@ private:
|
|||
FGColumnVector3 vForce;
|
||||
FGColumnVector3 vLocalForce;
|
||||
FGColumnVector3 vWhlVelVec; // Velocity of this wheel (Local)
|
||||
float SteerAngle;
|
||||
float kSpring;
|
||||
float bDamp;
|
||||
float compressLength;
|
||||
float compressSpeed;
|
||||
float staticFCoeff, dynamicFCoeff, rollingFCoeff;
|
||||
float brakePct;
|
||||
float BrakeFCoeff;
|
||||
float maxCompLen;
|
||||
double SteerAngle;
|
||||
double kSpring;
|
||||
double bDamp;
|
||||
double compressLength;
|
||||
double compressSpeed;
|
||||
double staticFCoeff, dynamicFCoeff, rollingFCoeff;
|
||||
double brakePct;
|
||||
double BrakeFCoeff;
|
||||
double maxCompLen;
|
||||
double SinkRate;
|
||||
double GroundSpeed;
|
||||
double DistanceTraveled;
|
||||
double MaximumStrutForce;
|
||||
double MaximumStrutTravel;
|
||||
bool WOW;
|
||||
bool lastWOW;
|
||||
bool FirstContact;
|
||||
bool Reported;
|
||||
bool ReportEnable;
|
||||
|
@ -263,7 +264,7 @@ private:
|
|||
string sBrakeGroup;
|
||||
BrakeGroup eBrakeGrp;
|
||||
SteerType eSteerType;
|
||||
float maxSteerAngle;
|
||||
double maxSteerAngle;
|
||||
|
||||
FGFDMExec* Exec;
|
||||
FGState* State;
|
||||
|
|
|
@ -60,38 +60,38 @@ public:
|
|||
|
||||
bool Run(void);
|
||||
|
||||
inline float GetMass(void) {return Mass;}
|
||||
inline float GetWeight(void) {return Weight;}
|
||||
inline float GetIxx(void) {return Ixx;}
|
||||
inline float GetIyy(void) {return Iyy;}
|
||||
inline float GetIzz(void) {return Izz;}
|
||||
inline float GetIxz(void) {return Ixz;}
|
||||
inline float GetIyz(void) {return Iyz;}
|
||||
inline double GetMass(void) {return Mass;}
|
||||
inline double GetWeight(void) {return Weight;}
|
||||
inline double GetIxx(void) {return Ixx;}
|
||||
inline double GetIyy(void) {return Iyy;}
|
||||
inline double GetIzz(void) {return Izz;}
|
||||
inline double GetIxz(void) {return Ixz;}
|
||||
inline double GetIyz(void) {return Iyz;}
|
||||
inline FGColumnVector3& GetXYZcg(void) {return vXYZcg;}
|
||||
inline float GetXYZcg(int axis) {return vXYZcg(axis);}
|
||||
inline double GetXYZcg(int axis) {return vXYZcg(axis);}
|
||||
|
||||
inline void SetEmptyWeight(float EW) { EmptyWeight = EW;}
|
||||
inline void SetBaseIxx(float bixx) { baseIxx = bixx;}
|
||||
inline void SetBaseIyy(float biyy) { baseIyy = biyy;}
|
||||
inline void SetBaseIzz(float bizz) { baseIzz = bizz;}
|
||||
inline void SetBaseIxz(float bixz) { baseIxz = bixz;}
|
||||
inline void SetBaseIyz(float biyz) { baseIyz = biyz;}
|
||||
inline void SetEmptyWeight(double EW) { EmptyWeight = EW;}
|
||||
inline void SetBaseIxx(double bixx) { baseIxx = bixx;}
|
||||
inline void SetBaseIyy(double biyy) { baseIyy = biyy;}
|
||||
inline void SetBaseIzz(double bizz) { baseIzz = bizz;}
|
||||
inline void SetBaseIxz(double bixz) { baseIxz = bixz;}
|
||||
inline void SetBaseIyz(double biyz) { baseIyz = biyz;}
|
||||
inline void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = CG;}
|
||||
|
||||
private:
|
||||
float Weight;
|
||||
float EmptyWeight;
|
||||
float Mass;
|
||||
float Ixx;
|
||||
float Iyy;
|
||||
float Izz;
|
||||
float Ixz;
|
||||
float Iyz;
|
||||
float baseIxx;
|
||||
float baseIyy;
|
||||
float baseIzz;
|
||||
float baseIxz;
|
||||
float baseIyz;
|
||||
double Weight;
|
||||
double EmptyWeight;
|
||||
double Mass;
|
||||
double Ixx;
|
||||
double Iyy;
|
||||
double Izz;
|
||||
double Ixz;
|
||||
double Iyz;
|
||||
double baseIxx;
|
||||
double baseIyy;
|
||||
double baseIzz;
|
||||
double baseIxz;
|
||||
double baseIyz;
|
||||
FGColumnVector3 vXYZcg;
|
||||
FGColumnVector3 vXYZtank;
|
||||
FGColumnVector3 vbaseXYZcg;
|
||||
|
|
|
@ -93,7 +93,7 @@ ostream& operator<<(ostream& os, const FGMatrix33& M)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
FGMatrix33& FGMatrix33::operator<<(const float ff)
|
||||
FGMatrix33& FGMatrix33::operator<<(const double ff)
|
||||
{
|
||||
data[rowCtr][colCtr] = ff;
|
||||
if (++colCtr > Cols()) {
|
||||
|
@ -304,7 +304,7 @@ FGMatrix33 FGMatrix33::operator*(const FGMatrix33& M)
|
|||
|
||||
void FGMatrix33::operator*=(const FGMatrix33& M)
|
||||
{
|
||||
float a,b,c;
|
||||
double a,b,c;
|
||||
|
||||
a = data[1][1]; b=data[1][2]; c=data[1][3];
|
||||
data[1][1] = a*M(1,1) + b*M(2,1) + c*M(3,1);
|
||||
|
|
|
@ -111,7 +111,7 @@ public:
|
|||
FGMatrix33 operator*(const FGMatrix33& B);
|
||||
FGMatrix33 operator*(const double scalar);
|
||||
FGMatrix33 operator/(const double scalar);
|
||||
FGMatrix33& operator<<(const float ff);
|
||||
FGMatrix33& operator<<(const double ff);
|
||||
|
||||
friend ostream& operator<<(ostream& os, const FGMatrix33& M);
|
||||
friend istream& operator>>(istream& is, FGMatrix33& M);
|
||||
|
|
|
@ -58,7 +58,7 @@ FGNozzle::FGNozzle(FGFDMExec* FDMExec, FGConfigFile* Nzl_cfg) : FGThruster(FDMEx
|
|||
|
||||
Name = Nzl_cfg->GetValue("NAME");
|
||||
Nzl_cfg->GetNextConfigLine();
|
||||
while (Nzl_cfg->GetValue() != "/FG_NOZZLE") {
|
||||
while (Nzl_cfg->GetValue() != string("/FG_NOZZLE")) {
|
||||
*Nzl_cfg >> token;
|
||||
if (token == "PE") *Nzl_cfg >> PE;
|
||||
else if (token == "EXPR") *Nzl_cfg >> ExpR;
|
||||
|
@ -92,10 +92,10 @@ FGNozzle::~FGNozzle()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGNozzle::Calculate(float CfPc)
|
||||
double FGNozzle::Calculate(double CfPc)
|
||||
{
|
||||
float pAtm = fdmex->GetAtmosphere()->GetPressure();
|
||||
Thrust = max((float)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff);
|
||||
double pAtm = fdmex->GetAtmosphere()->GetPressure();
|
||||
Thrust = max((double)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff);
|
||||
vFn(1) = Thrust;
|
||||
|
||||
return Thrust;
|
||||
|
@ -103,7 +103,7 @@ float FGNozzle::Calculate(float CfPc)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGNozzle::GetPowerRequired(void)
|
||||
double FGNozzle::GetPowerRequired(void)
|
||||
{
|
||||
return PE;
|
||||
}
|
||||
|
|
|
@ -73,16 +73,16 @@ public:
|
|||
/// Destructor
|
||||
~FGNozzle();
|
||||
|
||||
float Calculate(float CfPc);
|
||||
float GetPowerRequired(void);
|
||||
double Calculate(double CfPc);
|
||||
double GetPowerRequired(void);
|
||||
|
||||
private:
|
||||
float PE;
|
||||
float ExpR;
|
||||
float nzlEff;
|
||||
float Diameter;
|
||||
float AreaT;
|
||||
float Area2;
|
||||
double PE;
|
||||
double ExpR;
|
||||
double nzlEff;
|
||||
double Diameter;
|
||||
double AreaT;
|
||||
double Area2;
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void FGOutput::SetType(string type)
|
|||
Type = otSocket;
|
||||
} else if (type == "TERMINAL") {
|
||||
Type = otTerminal;
|
||||
} else if (type != "NONE"){
|
||||
} else if (type != string("NONE")){
|
||||
Type = otUnknown;
|
||||
cerr << "Unknown type of output specified in config file" << endl;
|
||||
}
|
||||
|
@ -130,25 +130,23 @@ void FGOutput::SetType(string type)
|
|||
|
||||
void FGOutput::DelimitedOutput(string fname)
|
||||
{
|
||||
# if defined(sgi) && !defined(__GNUC__)
|
||||
ostream_withassign outstream;
|
||||
# else
|
||||
_IO_ostream_withassign outstream;
|
||||
# endif
|
||||
streambuf* buffer;
|
||||
|
||||
if (fname == "COUT" || fname == "cout") {
|
||||
outstream = cout;
|
||||
buffer = cout.rdbuf();
|
||||
} else {
|
||||
datafile.open(fname.c_str());
|
||||
outstream = datafile;
|
||||
buffer = datafile.rdbuf();
|
||||
}
|
||||
|
||||
ostream outstream(buffer);
|
||||
|
||||
if (dFirstPass) {
|
||||
outstream << "Time";
|
||||
if (SubSystems & FGAircraft::ssSimulation) {
|
||||
if (SubSystems & ssSimulation) {
|
||||
// Nothing here, yet
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
||||
if (SubSystems & ssAerosurfaces) {
|
||||
outstream << ", ";
|
||||
outstream << "Throttle, ";
|
||||
outstream << "Mixture, ";
|
||||
|
@ -159,11 +157,11 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << "Elevator Pos, ";
|
||||
outstream << "Rudder Pos";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssRates) {
|
||||
if (SubSystems & ssRates) {
|
||||
outstream << ", ";
|
||||
outstream << "P, Q, R";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssVelocities) {
|
||||
if (SubSystems & ssVelocities) {
|
||||
outstream << ", ";
|
||||
outstream << "QBar, ";
|
||||
outstream << "Vtotal, ";
|
||||
|
@ -171,21 +169,21 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << "UAero, VAero, WAero, ";
|
||||
outstream << "Vn, Ve, Vd";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssForces) {
|
||||
if (SubSystems & ssForces) {
|
||||
outstream << ", ";
|
||||
outstream << "Drag, Side, Lift, ";
|
||||
outstream << "L/D, ";
|
||||
outstream << "Xforce, Yforce, Zforce";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssMoments) {
|
||||
if (SubSystems & ssMoments) {
|
||||
outstream << ", ";
|
||||
outstream << "L, M, N";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssAtmosphere) {
|
||||
if (SubSystems & ssAtmosphere) {
|
||||
outstream << ", ";
|
||||
outstream << "Rho";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssMassProps) {
|
||||
if (SubSystems & ssMassProps) {
|
||||
outstream << ", ";
|
||||
outstream << "Ixx, ";
|
||||
outstream << "Iyy, ";
|
||||
|
@ -194,7 +192,7 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << "Mass, ";
|
||||
outstream << "Xcg, Ycg, Zcg";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssPosition) {
|
||||
if (SubSystems & ssPosition) {
|
||||
outstream << ", ";
|
||||
outstream << "Altitude, ";
|
||||
outstream << "Phi, Tht, Psi, ";
|
||||
|
@ -204,15 +202,15 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << "Distance AGL, ";
|
||||
outstream << "Runway Radius";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssCoefficients) {
|
||||
if (SubSystems & ssCoefficients) {
|
||||
outstream << ", ";
|
||||
outstream << Aerodynamics->GetCoefficientStrings();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssGroundReactions) {
|
||||
if (SubSystems & ssGroundReactions) {
|
||||
outstream << ", ";
|
||||
outstream << GroundReactions->GetGroundReactionStrings();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssPropulsion) {
|
||||
if (SubSystems & ssPropulsion) {
|
||||
outstream << ", ";
|
||||
outstream << Propulsion->GetPropulsionStrings();
|
||||
}
|
||||
|
@ -222,9 +220,9 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
}
|
||||
|
||||
outstream << State->Getsim_time();
|
||||
if (SubSystems & FGAircraft::ssSimulation) {
|
||||
if (SubSystems & ssSimulation) {
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssAerosurfaces) {
|
||||
if (SubSystems & ssAerosurfaces) {
|
||||
outstream << ", ";
|
||||
outstream << FCS->GetThrottlePos(0) << ", ";
|
||||
outstream << FCS->GetMixturePos(0) << ", ";
|
||||
|
@ -235,11 +233,11 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << FCS->GetDePos() << ", ";
|
||||
outstream << FCS->GetDrPos();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssRates) {
|
||||
if (SubSystems & ssRates) {
|
||||
outstream << ", ";
|
||||
outstream << Rotation->GetPQR();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssVelocities) {
|
||||
if (SubSystems & ssVelocities) {
|
||||
outstream << ", ";
|
||||
outstream << Translation->Getqbar() << ", ";
|
||||
outstream << Translation->GetVt() << ", ";
|
||||
|
@ -247,21 +245,21 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << Translation->GetvAero() << ", ";
|
||||
outstream << Position->GetVel();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssForces) {
|
||||
if (SubSystems & ssForces) {
|
||||
outstream << ", ";
|
||||
outstream << Aerodynamics->GetvFs() << ", ";
|
||||
outstream << Aerodynamics->GetLoD() << ", ";
|
||||
outstream << Aircraft->GetForces();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssMoments) {
|
||||
if (SubSystems & ssMoments) {
|
||||
outstream << ", ";
|
||||
outstream << Aircraft->GetMoments();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssAtmosphere) {
|
||||
if (SubSystems & ssAtmosphere) {
|
||||
outstream << ", ";
|
||||
outstream << Atmosphere->GetDensity();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssMassProps) {
|
||||
if (SubSystems & ssMassProps) {
|
||||
outstream << ", ";
|
||||
outstream << MassBalance->GetIxx() << ", ";
|
||||
outstream << MassBalance->GetIyy() << ", ";
|
||||
|
@ -270,7 +268,7 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << MassBalance->GetMass() << ", ";
|
||||
outstream << MassBalance->GetXYZcg();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssPosition) {
|
||||
if (SubSystems & ssPosition) {
|
||||
outstream << ", ";
|
||||
outstream << Position->Geth() << ", ";
|
||||
outstream << Rotation->GetEuler() << ", ";
|
||||
|
@ -280,15 +278,15 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
outstream << Position->GetDistanceAGL() << ", ";
|
||||
outstream << Position->GetRunwayRadius();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssCoefficients) {
|
||||
if (SubSystems & ssCoefficients) {
|
||||
outstream << ", ";
|
||||
outstream << Aerodynamics->GetCoefficientValues();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssGroundReactions) {
|
||||
if (SubSystems & ssGroundReactions) {
|
||||
outstream << ", ";
|
||||
outstream << GroundReactions->GetGroundReactionValues();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssPropulsion) {
|
||||
if (SubSystems & ssPropulsion) {
|
||||
outstream << ", ";
|
||||
outstream << Propulsion->GetPropulsionValues();
|
||||
}
|
||||
|
@ -410,6 +408,82 @@ void FGOutput::SocketStatusOutput(string out_str)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGOutput::Load(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token, parameter;
|
||||
int OutRate = 0;
|
||||
|
||||
token = AC_cfg->GetValue("NAME");
|
||||
Output->SetFilename(token);
|
||||
token = AC_cfg->GetValue("TYPE");
|
||||
Output->SetType(token);
|
||||
AC_cfg->GetNextConfigLine();
|
||||
|
||||
while ((token = AC_cfg->GetValue()) != string("/OUTPUT")) {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate;
|
||||
if (parameter == "SIMULATION") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssSimulation;
|
||||
}
|
||||
if (parameter == "AEROSURFACES") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssAerosurfaces;
|
||||
}
|
||||
if (parameter == "RATES") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssRates;
|
||||
}
|
||||
if (parameter == "VELOCITIES") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssVelocities;
|
||||
}
|
||||
if (parameter == "FORCES") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssForces;
|
||||
}
|
||||
if (parameter == "MOMENTS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssMoments;
|
||||
}
|
||||
if (parameter == "ATMOSPHERE") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssAtmosphere;
|
||||
}
|
||||
if (parameter == "MASSPROPS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssMassProps;
|
||||
}
|
||||
if (parameter == "POSITION") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssPosition;
|
||||
}
|
||||
if (parameter == "COEFFICIENTS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssCoefficients;
|
||||
}
|
||||
if (parameter == "GROUND_REACTIONS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssGroundReactions;
|
||||
}
|
||||
if (parameter == "FCS") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssFCS;
|
||||
}
|
||||
if (parameter == "PROPULSION") {
|
||||
*AC_cfg >> parameter;
|
||||
if (parameter == "ON") SubSystems += ssPropulsion;
|
||||
}
|
||||
}
|
||||
|
||||
OutRate = OutRate>120?120:(OutRate<0?0:OutRate);
|
||||
rate = (int)(0.5 + 1.0/(State->Getdt()*OutRate));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGOutput::Debug(void)
|
||||
{
|
||||
//TODO: Add your source code here
|
||||
|
|
|
@ -79,6 +79,24 @@ public:
|
|||
inline void Enable(void) { enabled = true; }
|
||||
inline void Disable(void) { enabled = false; }
|
||||
inline bool Toggle(void) {enabled = !enabled; return enabled;}
|
||||
bool Load(FGConfigFile* AC_cfg);
|
||||
|
||||
/// Subsystem types for specifying which will be output in the FDM data logging
|
||||
enum SubSystems {
|
||||
/** Subsystem: Simulation (= 1) */ ssSimulation = 1,
|
||||
/** Subsystem: Aerosurfaces (= 2) */ ssAerosurfaces = 2,
|
||||
/** Subsystem: Body rates (= 4) */ ssRates = 4,
|
||||
/** Subsystem: Velocities (= 8) */ ssVelocities = 8,
|
||||
/** Subsystem: Forces (= 16) */ ssForces = 16,
|
||||
/** Subsystem: Moments (= 32) */ ssMoments = 32,
|
||||
/** Subsystem: Atmosphere (= 64) */ ssAtmosphere = 64,
|
||||
/** Subsystem: Mass Properties (= 128) */ ssMassProps = 128,
|
||||
/** Subsystem: Coefficients (= 256) */ ssCoefficients = 256,
|
||||
/** Subsystem: Position (= 512) */ ssPosition = 512,
|
||||
/** Subsystem: Ground Reactions (= 1024) */ ssGroundReactions = 1024,
|
||||
/** Subsystem: FCS (= 2048) */ ssFCS = 2048,
|
||||
/** Subsystem: Propulsion (= 4096) */ ssPropulsion = 4096
|
||||
} subsystems;
|
||||
|
||||
private:
|
||||
bool sFirstPass, dFirstPass, enabled;
|
||||
|
|
|
@ -68,7 +68,7 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
|
|||
|
||||
Name = Eng_cfg->GetValue("NAME");
|
||||
Eng_cfg->GetNextConfigLine();
|
||||
while (Eng_cfg->GetValue() != "/FG_PISTON") {
|
||||
while (Eng_cfg->GetValue() != string("/FG_PISTON")) {
|
||||
*Eng_cfg >> token;
|
||||
if (token == "MINMP") *Eng_cfg >> MinManifoldPressure_inHg;
|
||||
else if (token == "MAXMP") *Eng_cfg >> MaxManifoldPressure_inHg;
|
||||
|
@ -156,9 +156,9 @@ FGPiston::~FGPiston()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGPiston::Calculate(float PowerRequired)
|
||||
double FGPiston::Calculate(double PowerRequired)
|
||||
{
|
||||
float h,EngineMaxPower;
|
||||
double h,EngineMaxPower;
|
||||
|
||||
// FIXME: calculate from actual fuel flow
|
||||
ConsumeFuel();
|
||||
|
@ -328,10 +328,10 @@ void FGPiston::doManifoldPressure(void)
|
|||
void FGPiston::doAirFlow(void)
|
||||
{
|
||||
rho_air = p_amb / (R_air * T_amb);
|
||||
float rho_air_manifold = rho_air * ManifoldPressure_inHg / 29.6;
|
||||
float displacement_SI = Displacement * CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
|
||||
float swept_volume = (displacement_SI * (RPM/60)) / 2;
|
||||
float v_dot_air = swept_volume * volumetric_efficiency;
|
||||
double rho_air_manifold = rho_air * ManifoldPressure_inHg / 29.6;
|
||||
double displacement_SI = Displacement * CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
|
||||
double swept_volume = (displacement_SI * (RPM/60)) / 2;
|
||||
double v_dot_air = swept_volume * volumetric_efficiency;
|
||||
m_dot_air = v_dot_air * rho_air_manifold;
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,7 @@ void FGPiston::doAirFlow(void)
|
|||
|
||||
void FGPiston::doFuelFlow(void)
|
||||
{
|
||||
float thi_sea_level = 1.3 * Mixture;
|
||||
double thi_sea_level = 1.3 * Mixture;
|
||||
equivalence_ratio = thi_sea_level * p_amb_sea_level / p_amb;
|
||||
m_dot_fuel = m_dot_air / 14.7 * equivalence_ratio;
|
||||
}
|
||||
|
@ -368,15 +368,15 @@ void FGPiston::doFuelFlow(void)
|
|||
|
||||
void FGPiston::doEnginePower(void)
|
||||
{
|
||||
float True_ManifoldPressure_inHg = ManifoldPressure_inHg * p_amb / p_amb_sea_level;
|
||||
float ManXRPM = True_ManifoldPressure_inHg * RPM;
|
||||
double True_ManifoldPressure_inHg = ManifoldPressure_inHg * p_amb / p_amb_sea_level;
|
||||
double ManXRPM = True_ManifoldPressure_inHg * RPM;
|
||||
// FIXME: this needs to be generalized
|
||||
Percentage_Power = (6e-9 * ManXRPM * ManXRPM) + (8e-4 * ManXRPM) - 1.0;
|
||||
float T_amb_degF = (T_amb * 1.8) - 459.67;
|
||||
float T_amb_sea_lev_degF = (288 * 1.8) - 459.67;
|
||||
double T_amb_degF = (T_amb * 1.8) - 459.67;
|
||||
double T_amb_sea_lev_degF = (288 * 1.8) - 459.67;
|
||||
Percentage_Power =
|
||||
Percentage_Power + ((T_amb_sea_lev_degF - T_amb_degF) * 7 /120);
|
||||
float Percentage_of_best_power_mixture_power =
|
||||
double Percentage_of_best_power_mixture_power =
|
||||
Power_Mixture_Correlation->GetValue(14.7 / equivalence_ratio);
|
||||
Percentage_Power =
|
||||
Percentage_Power * Percentage_of_best_power_mixture_power / 100.0;
|
||||
|
@ -417,10 +417,10 @@ void FGPiston::doEnginePower(void)
|
|||
void FGPiston::doEGT(void)
|
||||
{
|
||||
combustion_efficiency = Lookup_Combustion_Efficiency->GetValue(equivalence_ratio);
|
||||
float enthalpy_exhaust = m_dot_fuel * calorific_value_fuel *
|
||||
double enthalpy_exhaust = m_dot_fuel * calorific_value_fuel *
|
||||
combustion_efficiency * 0.33;
|
||||
float heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
|
||||
float delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust;
|
||||
double heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
|
||||
double delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust;
|
||||
ExhaustGasTemp_degK = T_amb + delta_T_exhaust;
|
||||
ExhaustGasTemp_degK *= 0.444 + ((0.544 - 0.444) * Percentage_Power / 100.0);
|
||||
}
|
||||
|
@ -437,26 +437,26 @@ void FGPiston::doEGT(void)
|
|||
|
||||
void FGPiston::doCHT(void)
|
||||
{
|
||||
float h1 = -95.0;
|
||||
float h2 = -3.95;
|
||||
float h3 = -0.05;
|
||||
double h1 = -95.0;
|
||||
double h2 = -3.95;
|
||||
double h3 = -0.05;
|
||||
|
||||
float arbitary_area = 1.0;
|
||||
float CpCylinderHead = 800.0;
|
||||
float MassCylinderHead = 8.0;
|
||||
double arbitary_area = 1.0;
|
||||
double CpCylinderHead = 800.0;
|
||||
double MassCylinderHead = 8.0;
|
||||
|
||||
float temperature_difference = CylinderHeadTemp_degK - T_amb;
|
||||
float v_apparent = IAS * 0.5144444;
|
||||
float v_dot_cooling_air = arbitary_area * v_apparent;
|
||||
float m_dot_cooling_air = v_dot_cooling_air * rho_air;
|
||||
float dqdt_from_combustion =
|
||||
double temperature_difference = CylinderHeadTemp_degK - T_amb;
|
||||
double v_apparent = IAS * 0.5144444;
|
||||
double v_dot_cooling_air = arbitary_area * v_apparent;
|
||||
double m_dot_cooling_air = v_dot_cooling_air * rho_air;
|
||||
double dqdt_from_combustion =
|
||||
m_dot_fuel * calorific_value_fuel * combustion_efficiency * 0.33;
|
||||
float dqdt_forced = (h2 * m_dot_cooling_air * temperature_difference) +
|
||||
double dqdt_forced = (h2 * m_dot_cooling_air * temperature_difference) +
|
||||
(h3 * RPM * temperature_difference);
|
||||
float dqdt_free = h1 * temperature_difference;
|
||||
float dqdt_cylinder_head = dqdt_from_combustion + dqdt_forced + dqdt_free;
|
||||
double dqdt_free = h1 * temperature_difference;
|
||||
double dqdt_cylinder_head = dqdt_from_combustion + dqdt_forced + dqdt_free;
|
||||
|
||||
float HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
|
||||
double HeatCapacityCylinderHead = CpCylinderHead * MassCylinderHead;
|
||||
|
||||
CylinderHeadTemp_degK = dqdt_cylinder_head / HeatCapacityCylinderHead;
|
||||
}
|
||||
|
@ -472,9 +472,9 @@ void FGPiston::doCHT(void)
|
|||
|
||||
void FGPiston::doOilTemperature(void)
|
||||
{
|
||||
float idle_percentage_power = 2.3; // approximately
|
||||
float target_oil_temp; // Steady state oil temp at the current engine conditions
|
||||
float time_constant; // The time constant for the differential equation
|
||||
double idle_percentage_power = 2.3; // approximately
|
||||
double target_oil_temp; // Steady state oil temp at the current engine conditions
|
||||
double time_constant; // The time constant for the differential equation
|
||||
|
||||
if (Running) {
|
||||
target_oil_temp = 363;
|
||||
|
@ -488,7 +488,7 @@ void FGPiston::doOilTemperature(void)
|
|||
// that oil is no longer getting circulated
|
||||
}
|
||||
|
||||
float dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
|
||||
double dOilTempdt = (target_oil_temp - OilTemp_degK) / time_constant;
|
||||
|
||||
OilTemp_degK += (dOilTempdt * dt);
|
||||
}
|
||||
|
@ -504,11 +504,11 @@ void FGPiston::doOilTemperature(void)
|
|||
|
||||
void FGPiston::doOilPressure(void)
|
||||
{
|
||||
float Oil_Press_Relief_Valve = 60; // FIXME: may vary by engine
|
||||
float Oil_Press_RPM_Max = 1800; // FIXME: may vary by engine
|
||||
float Design_Oil_Temp = 85; // FIXME: may vary by engine
|
||||
double Oil_Press_Relief_Valve = 60; // FIXME: may vary by engine
|
||||
double Oil_Press_RPM_Max = 1800; // FIXME: may vary by engine
|
||||
double Design_Oil_Temp = 85; // FIXME: may vary by engine
|
||||
// FIXME: WRONG!!! (85 degK???)
|
||||
float Oil_Viscosity_Index = 0.25;
|
||||
double Oil_Viscosity_Index = 0.25;
|
||||
|
||||
OilPressure_psi = (Oil_Press_Relief_Valve / Oil_Press_RPM_Max) * RPM;
|
||||
|
||||
|
|
|
@ -84,18 +84,18 @@ public:
|
|||
/// Destructor
|
||||
~FGPiston();
|
||||
|
||||
float Calculate(float PowerRequired);
|
||||
float GetPowerAvailable(void) {return PowerAvailable;}
|
||||
double Calculate(double PowerRequired);
|
||||
double GetPowerAvailable(void) {return PowerAvailable;}
|
||||
|
||||
private:
|
||||
float BrakeHorsePower;
|
||||
float SpeedSlope;
|
||||
float SpeedIntercept;
|
||||
float AltitudeSlope;
|
||||
float PowerAvailable;
|
||||
double BrakeHorsePower;
|
||||
double SpeedSlope;
|
||||
double SpeedIntercept;
|
||||
double AltitudeSlope;
|
||||
double PowerAvailable;
|
||||
|
||||
// timestep
|
||||
float dt;
|
||||
double dt;
|
||||
|
||||
void doEngineStartup(void);
|
||||
void doManifoldPressure(void);
|
||||
|
@ -110,13 +110,13 @@ private:
|
|||
//
|
||||
// constants
|
||||
//
|
||||
const float CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
|
||||
const double CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
|
||||
|
||||
const float R_air;
|
||||
const float rho_fuel; // kg/m^3
|
||||
const float calorific_value_fuel; // W/Kg (approximate)
|
||||
const float Cp_air; // J/KgK
|
||||
const float Cp_fuel; // J/KgK
|
||||
const double R_air;
|
||||
const double rho_fuel; // kg/m^3
|
||||
const double calorific_value_fuel; // W/Kg (approximate)
|
||||
const double Cp_air; // J/KgK
|
||||
const double Cp_fuel; // J/KgK
|
||||
|
||||
FGTable *Lookup_Combustion_Efficiency;
|
||||
FGTable *Power_Mixture_Correlation;
|
||||
|
@ -124,35 +124,35 @@ private:
|
|||
//
|
||||
// Configuration
|
||||
//
|
||||
float MinManifoldPressure_inHg; // Inches Hg
|
||||
float MaxManifoldPressure_inHg; // Inches Hg
|
||||
float Displacement; // cubic inches
|
||||
float MaxHP; // horsepower
|
||||
float Cycles; // cycles/power stroke
|
||||
float IdleRPM; // revolutions per minute
|
||||
double MinManifoldPressure_inHg; // Inches Hg
|
||||
double MaxManifoldPressure_inHg; // Inches Hg
|
||||
double Displacement; // cubic inches
|
||||
double MaxHP; // horsepower
|
||||
double Cycles; // cycles/power stroke
|
||||
double IdleRPM; // revolutions per minute
|
||||
|
||||
//
|
||||
// Inputs (in addition to those in FGEngine).
|
||||
//
|
||||
float p_amb; // Pascals
|
||||
float p_amb_sea_level; // Pascals
|
||||
float T_amb; // degrees Kelvin
|
||||
float RPM; // revolutions per minute
|
||||
float IAS; // knots
|
||||
double p_amb; // Pascals
|
||||
double p_amb_sea_level; // Pascals
|
||||
double T_amb; // degrees Kelvin
|
||||
double RPM; // revolutions per minute
|
||||
double IAS; // knots
|
||||
|
||||
//
|
||||
// Outputs (in addition to those in FGEngine).
|
||||
//
|
||||
bool Magneto_Left;
|
||||
bool Magneto_Right;
|
||||
float rho_air;
|
||||
float volumetric_efficiency;
|
||||
float m_dot_air;
|
||||
float equivalence_ratio;
|
||||
float m_dot_fuel;
|
||||
float Percentage_Power;
|
||||
float HP;
|
||||
float combustion_efficiency;
|
||||
double rho_air;
|
||||
double volumetric_efficiency;
|
||||
double m_dot_air;
|
||||
double equivalence_ratio;
|
||||
double m_dot_fuel;
|
||||
double Percentage_Power;
|
||||
double HP;
|
||||
double combustion_efficiency;
|
||||
|
||||
void Debug(void);
|
||||
};
|
||||
|
|
|
@ -91,7 +91,7 @@ static const char *IdHdr = ID_POSITION;
|
|||
CLASS IMPLEMENTATION
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
extern float globalTriNormal[3];
|
||||
extern double globalTriNormal[3];
|
||||
extern double globalSceneryAltitude;
|
||||
extern double globalSeaLevelRadius;
|
||||
|
||||
|
|
|
@ -104,10 +104,10 @@ public:
|
|||
inline FGColumnVector3& GetRunwayNormal(void) { return vRunwayNormal; }
|
||||
|
||||
inline double GetGamma(void) { return gamma; }
|
||||
inline void SetGamma(float tt) { gamma = tt; }
|
||||
inline void SetGamma(double tt) { gamma = tt; }
|
||||
inline double GetHOverB(void) { return hoverb; }
|
||||
void SetvVel(const FGColumnVector3& v) { vVel = v; }
|
||||
void SetLatitude(float tt) { Latitude = tt; }
|
||||
void SetLatitude(double tt) { Latitude = tt; }
|
||||
void SetLongitude(double tt) { Longitude = tt; }
|
||||
void Seth(double tt);
|
||||
void SetRunwayRadius(double tt) { RunwayRadius = tt; }
|
||||
|
@ -127,13 +127,13 @@ private:
|
|||
double LatitudeDot, LongitudeDot, RadiusDot;
|
||||
double lastLatitudeDot, lastLongitudeDot, lastRadiusDot;
|
||||
double Longitude, Latitude;
|
||||
float dt;
|
||||
double dt;
|
||||
double RunwayRadius;
|
||||
double DistanceAGL;
|
||||
double SeaLevelRadius;
|
||||
double gamma;
|
||||
double Vt, Vground;
|
||||
float hoverb,b;
|
||||
double hoverb,b;
|
||||
|
||||
double psigt;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(e
|
|||
|
||||
Name = Prop_cfg->GetValue("NAME");
|
||||
Prop_cfg->GetNextConfigLine();
|
||||
while (Prop_cfg->GetValue() != "/FG_PROPELLER") {
|
||||
while (Prop_cfg->GetValue() != string("/FG_PROPELLER")) {
|
||||
*Prop_cfg >> token;
|
||||
if (token == "IXX") {
|
||||
*Prop_cfg >> Ixx;
|
||||
|
@ -135,13 +135,13 @@ FGPropeller::~FGPropeller()
|
|||
//
|
||||
// Because RPM could be zero, we need to be creative about what RPM is stated as.
|
||||
|
||||
float FGPropeller::Calculate(float PowerAvailable)
|
||||
double FGPropeller::Calculate(double PowerAvailable)
|
||||
{
|
||||
float J, C_Thrust, omega;
|
||||
float Vel = (fdmex->GetTranslation()->GetvAero())(1);
|
||||
float rho = fdmex->GetAtmosphere()->GetDensity();
|
||||
float RPS = RPM/60.0;
|
||||
float alpha, beta;
|
||||
double J, C_Thrust, omega;
|
||||
double Vel = (fdmex->GetTranslation()->GetvAero())(1);
|
||||
double rho = fdmex->GetAtmosphere()->GetDensity();
|
||||
double RPS = RPM/60.0;
|
||||
double alpha, beta;
|
||||
|
||||
if (RPM > 0.10) {
|
||||
J = Vel / (Diameter * RPM / 60.0);
|
||||
|
@ -188,14 +188,14 @@ float FGPropeller::Calculate(float PowerAvailable)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGPropeller::GetPowerRequired(void)
|
||||
double FGPropeller::GetPowerRequired(void)
|
||||
{
|
||||
if (RPM <= 0.10) return 0.0; // If the prop ain't turnin', the fuel ain't burnin'.
|
||||
|
||||
float cPReq, RPS = RPM / 60.0;
|
||||
double cPReq, RPS = RPM / 60.0;
|
||||
|
||||
float J = (fdmex->GetTranslation()->GetvAero())(1) / (Diameter * RPS);
|
||||
float rho = fdmex->GetAtmosphere()->GetDensity();
|
||||
double J = (fdmex->GetTranslation()->GetvAero())(1) / (Diameter * RPS);
|
||||
double rho = fdmex->GetAtmosphere()->GetDensity();
|
||||
|
||||
if (MaxPitch == MinPitch) { // Fixed pitch prop
|
||||
cPReq = cPower->GetValue(J);
|
||||
|
|
|
@ -104,7 +104,7 @@ public:
|
|||
equation for rotational acceleration "a": a = Q/I , where Q is Torque and
|
||||
I is moment of inertia for the propeller.
|
||||
@param rpm the rotational velocity of the propeller */
|
||||
void SetRPM(float rpm) {RPM = rpm;}
|
||||
void SetRPM(double rpm) {RPM = rpm;}
|
||||
|
||||
/** This commands the pitch of the blade to change to the value supplied.
|
||||
This call is meant to be issued either from the cockpit or by the flight
|
||||
|
@ -114,28 +114,28 @@ public:
|
|||
indices to the power, thrust, and efficiency tables for variable-pitch
|
||||
propellers.
|
||||
@param pitch the pitch of the blade in degrees. */
|
||||
void SetPitch(float pitch) {Pitch = pitch;}
|
||||
void SetPitch(double pitch) {Pitch = pitch;}
|
||||
|
||||
void SetPFactor(double pf) {P_Factor = pf;}
|
||||
|
||||
void SetSense(double s) { Sense = s;}
|
||||
|
||||
/// Retrieves the pitch of the propeller in degrees.
|
||||
float GetPitch(void) { return Pitch; }
|
||||
double GetPitch(void) { return Pitch; }
|
||||
|
||||
/// Retrieves the RPMs of the propeller
|
||||
float GetRPM(void) { return RPM; }
|
||||
double GetRPM(void) { return RPM; }
|
||||
|
||||
/// Retrieves the propeller moment of inertia
|
||||
float GetIxx(void) { return Ixx; }
|
||||
double GetIxx(void) { return Ixx; }
|
||||
|
||||
/// Retrieves the Torque in foot-pounds (Don't you love the English system?)
|
||||
float GetTorque(void) { return Torque; }
|
||||
double GetTorque(void) { return Torque; }
|
||||
|
||||
/** Retrieves the power required (or "absorbed") by the propeller -
|
||||
i.e. the power required to keep spinning the propeller at the current
|
||||
velocity, air density, and rotational rate. */
|
||||
float GetPowerRequired(void);
|
||||
double GetPowerRequired(void);
|
||||
|
||||
/** Calculates and returns the thrust produced by this propeller.
|
||||
Given the excess power available from the engine (in foot-pounds), the thrust is
|
||||
|
@ -146,19 +146,19 @@ public:
|
|||
accelerate the prop. It could be negative, dictating that the propeller
|
||||
would be slowed.
|
||||
@return the thrust in pounds */
|
||||
float Calculate(float PowerAvailable);
|
||||
double Calculate(double PowerAvailable);
|
||||
|
||||
private:
|
||||
int numBlades;
|
||||
float RPM;
|
||||
float Ixx;
|
||||
float Diameter;
|
||||
float MaxPitch;
|
||||
float MinPitch;
|
||||
float P_Factor;
|
||||
float Sense;
|
||||
float Pitch;
|
||||
float Torque;
|
||||
double RPM;
|
||||
double Ixx;
|
||||
double Diameter;
|
||||
double MaxPitch;
|
||||
double MinPitch;
|
||||
double P_Factor;
|
||||
double Sense;
|
||||
double Pitch;
|
||||
double Torque;
|
||||
FGTable *Efficiency;
|
||||
FGTable *cThrust;
|
||||
FGTable *cPower;
|
||||
|
|
|
@ -87,8 +87,9 @@ FGPropulsion::~FGPropulsion()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGPropulsion::Run(void) {
|
||||
float PowerAvailable;
|
||||
bool FGPropulsion::Run(void)
|
||||
{
|
||||
double PowerAvailable;
|
||||
dt = State->Getdt();
|
||||
|
||||
Forces->InitMatrix();
|
||||
|
@ -102,7 +103,6 @@ bool FGPropulsion::Run(void) {
|
|||
*Forces += Thrusters[i]->GetBodyForces(); // sum body frame forces
|
||||
*Moments += Thrusters[i]->GetMoments(); // sum body frame moments
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -112,8 +112,8 @@ bool FGPropulsion::Run(void) {
|
|||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGPropulsion::GetSteadyState(void) {
|
||||
float PowerAvailable;
|
||||
float currentThrust = 0, lastThrust=-1;
|
||||
double PowerAvailable;
|
||||
double currentThrust = 0, lastThrust=-1;
|
||||
dt = State->Getdt();
|
||||
int steady_count,j=0;
|
||||
bool steady=false;
|
||||
|
@ -153,7 +153,7 @@ bool FGPropulsion::GetSteadyState(void) {
|
|||
|
||||
|
||||
bool FGPropulsion::ICEngineStart(void) {
|
||||
float PowerAvailable;
|
||||
double PowerAvailable;
|
||||
int j;
|
||||
dt = State->Getdt();
|
||||
|
||||
|
@ -198,7 +198,7 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
|
|||
|
||||
AC_cfg->GetNextConfigLine();
|
||||
|
||||
while ((token = AC_cfg->GetValue()) != "/PROPULSION") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/PROPULSION")) {
|
||||
|
||||
if (token == "AC_ENGINE") { // ============ READING ENGINES
|
||||
|
||||
|
@ -230,7 +230,7 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
|
|||
}
|
||||
|
||||
AC_cfg->GetNextConfigLine();
|
||||
while ((token = AC_cfg->GetValue()) != "/AC_ENGINE") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/AC_ENGINE")) {
|
||||
*AC_cfg >> token;
|
||||
if (token == "XLOC") { *AC_cfg >> xLoc; }
|
||||
else if (token == "YLOC") { *AC_cfg >> yLoc; }
|
||||
|
@ -299,7 +299,7 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
|
|||
}
|
||||
|
||||
AC_cfg->GetNextConfigLine();
|
||||
while ((token = AC_cfg->GetValue()) != "/AC_THRUSTER") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/AC_THRUSTER")) {
|
||||
*AC_cfg >> token;
|
||||
if (token == "XLOC") *AC_cfg >> xLoc;
|
||||
else if (token == "YLOC") *AC_cfg >> yLoc;
|
||||
|
@ -453,9 +453,9 @@ FGColumnVector3& FGPropulsion::GetTanksCG(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGPropulsion::GetTanksWeight(void)
|
||||
double FGPropulsion::GetTanksWeight(void)
|
||||
{
|
||||
float Tw = 0.0;
|
||||
double Tw = 0.0;
|
||||
|
||||
iTank = Tanks.begin();
|
||||
while (iTank < Tanks.end()) {
|
||||
|
@ -467,9 +467,9 @@ float FGPropulsion::GetTanksWeight(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGPropulsion::GetTanksIxx(const FGColumnVector3& vXYZcg)
|
||||
double FGPropulsion::GetTanksIxx(const FGColumnVector3& vXYZcg)
|
||||
{
|
||||
float I = 0.0;
|
||||
double I = 0.0;
|
||||
iTank = Tanks.begin();
|
||||
while (iTank < Tanks.end()) {
|
||||
I += ((*iTank)->GetX() - vXYZcg(eX))*((*iTank)->GetX() - vXYZcg(eX)) * (*iTank)->GetContents()/(144.0*Inertial->gravity());
|
||||
|
@ -480,9 +480,9 @@ float FGPropulsion::GetTanksIxx(const FGColumnVector3& vXYZcg)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGPropulsion::GetTanksIyy(const FGColumnVector3& vXYZcg)
|
||||
double FGPropulsion::GetTanksIyy(const FGColumnVector3& vXYZcg)
|
||||
{
|
||||
float I = 0.0;
|
||||
double I = 0.0;
|
||||
iTank = Tanks.begin();
|
||||
while (iTank < Tanks.end()) {
|
||||
I += ((*iTank)->GetY() - vXYZcg(eY))*((*iTank)->GetY() - vXYZcg(eY)) * (*iTank)->GetContents()/(144.0*Inertial->gravity());
|
||||
|
@ -493,9 +493,9 @@ float FGPropulsion::GetTanksIyy(const FGColumnVector3& vXYZcg)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGPropulsion::GetTanksIzz(const FGColumnVector3& vXYZcg)
|
||||
double FGPropulsion::GetTanksIzz(const FGColumnVector3& vXYZcg)
|
||||
{
|
||||
float I = 0.0;
|
||||
double I = 0.0;
|
||||
iTank = Tanks.begin();
|
||||
while (iTank < Tanks.end()) {
|
||||
I += ((*iTank)->GetZ() - vXYZcg(eZ))*((*iTank)->GetZ() - vXYZcg(eZ)) * (*iTank)->GetContents()/(144.0*Inertial->gravity());
|
||||
|
@ -506,9 +506,9 @@ float FGPropulsion::GetTanksIzz(const FGColumnVector3& vXYZcg)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGPropulsion::GetTanksIxz(const FGColumnVector3& vXYZcg)
|
||||
double FGPropulsion::GetTanksIxz(const FGColumnVector3& vXYZcg)
|
||||
{
|
||||
float I = 0.0;
|
||||
double I = 0.0;
|
||||
iTank = Tanks.begin();
|
||||
while (iTank < Tanks.end()) {
|
||||
I += ((*iTank)->GetX() - vXYZcg(eX))*((*iTank)->GetZ() - vXYZcg(eZ)) * (*iTank)->GetContents()/(144.0*Inertial->gravity());
|
||||
|
@ -519,9 +519,9 @@ float FGPropulsion::GetTanksIxz(const FGColumnVector3& vXYZcg)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGPropulsion::GetTanksIxy(const FGColumnVector3& vXYZcg)
|
||||
double FGPropulsion::GetTanksIxy(const FGColumnVector3& vXYZcg)
|
||||
{
|
||||
float I = 0.0;
|
||||
double I = 0.0;
|
||||
iTank = Tanks.begin();
|
||||
while (iTank != Tanks.end()) {
|
||||
I += ((*iTank)->GetX() - vXYZcg(eX))*((*iTank)->GetY() - vXYZcg(eY)) * (*iTank)->GetContents()/(144.0*Inertial->gravity());
|
||||
|
|
|
@ -169,18 +169,18 @@ public:
|
|||
string GetPropulsionValues(void);
|
||||
|
||||
inline FGColumnVector3& GetForces(void) {return *Forces; }
|
||||
inline float GetForces(int n) { return (*Forces)(n);}
|
||||
inline double GetForces(int n) { return (*Forces)(n);}
|
||||
inline FGColumnVector3& GetMoments(void) {return *Moments;}
|
||||
inline float GetMoments(int n) {return (*Moments)(n);}
|
||||
inline double GetMoments(int n) {return (*Moments)(n);}
|
||||
|
||||
FGColumnVector3& GetTanksCG(void);
|
||||
float GetTanksWeight(void);
|
||||
double GetTanksWeight(void);
|
||||
|
||||
float GetTanksIxx(const FGColumnVector3& vXYZcg);
|
||||
float GetTanksIyy(const FGColumnVector3& vXYZcg);
|
||||
float GetTanksIzz(const FGColumnVector3& vXYZcg);
|
||||
float GetTanksIxz(const FGColumnVector3& vXYZcg);
|
||||
float GetTanksIxy(const FGColumnVector3& vXYZcg);
|
||||
double GetTanksIxx(const FGColumnVector3& vXYZcg);
|
||||
double GetTanksIyy(const FGColumnVector3& vXYZcg);
|
||||
double GetTanksIzz(const FGColumnVector3& vXYZcg);
|
||||
double GetTanksIxz(const FGColumnVector3& vXYZcg);
|
||||
double GetTanksIxy(const FGColumnVector3& vXYZcg);
|
||||
|
||||
private:
|
||||
vector <FGEngine*> Engines;
|
||||
|
@ -194,7 +194,7 @@ private:
|
|||
unsigned int numEngines;
|
||||
unsigned int numTanks;
|
||||
unsigned int numThrusters;
|
||||
float dt;
|
||||
double dt;
|
||||
FGColumnVector3 *Forces;
|
||||
FGColumnVector3 *Moments;
|
||||
FGColumnVector3 vXYZtank;
|
||||
|
|
|
@ -54,7 +54,7 @@ FGRocket::FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec)
|
|||
Name = Eng_cfg->GetValue("NAME");
|
||||
Eng_cfg->GetNextConfigLine();
|
||||
|
||||
while (Eng_cfg->GetValue() != "/FG_ROCKET") {
|
||||
while (Eng_cfg->GetValue() != string("/FG_ROCKET")) {
|
||||
*Eng_cfg >> token;
|
||||
if (token == "SHR") *Eng_cfg >> SHR;
|
||||
else if (token == "MAX_PC") *Eng_cfg >> maxPC;
|
||||
|
@ -97,9 +97,9 @@ FGRocket::~FGRocket()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGRocket::Calculate(float pe)
|
||||
double FGRocket::Calculate(double pe)
|
||||
{
|
||||
float Cf;
|
||||
double Cf;
|
||||
|
||||
ConsumeFuel();
|
||||
|
||||
|
@ -111,7 +111,7 @@ float FGRocket::Calculate(float pe)
|
|||
PC = 0.0;
|
||||
} else {
|
||||
PctPower = Throttle / MaxThrottle;
|
||||
PC = maxPC*PctPower * (1.0 + Variance * ((float)rand()/(float)RAND_MAX - 0.5));
|
||||
PC = maxPC*PctPower * (1.0 + Variance * ((double)rand()/(double)RAND_MAX - 0.5));
|
||||
Cf = sqrt(kFactor*(1 - pow(pe/(PC), (SHR-1)/SHR)));
|
||||
Flameout = false;
|
||||
}
|
||||
|
|
|
@ -116,19 +116,19 @@ public:
|
|||
coefficient times the chamber pressure.
|
||||
@param pe nozzle exit pressure
|
||||
@return thrust coefficient times chamber pressure */
|
||||
float Calculate(float pe);
|
||||
double Calculate(double pe);
|
||||
|
||||
/** Gets the chamber pressure.
|
||||
@return chamber pressure in psf. */
|
||||
float GetChamberPressure(void) {return PC;}
|
||||
double GetChamberPressure(void) {return PC;}
|
||||
|
||||
private:
|
||||
float SHR;
|
||||
float maxPC;
|
||||
float propEff;
|
||||
float kFactor;
|
||||
float Variance;
|
||||
float PC;
|
||||
double SHR;
|
||||
double maxPC;
|
||||
double propEff;
|
||||
double kFactor;
|
||||
double Variance;
|
||||
double PC;
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
|
|
|
@ -101,8 +101,8 @@ FGRotation::~FGRotation()
|
|||
|
||||
bool FGRotation::Run(void)
|
||||
{
|
||||
float L2, N1;
|
||||
float tTheta;
|
||||
double L2, N1;
|
||||
double tTheta;
|
||||
|
||||
if (!FGModel::Run()) {
|
||||
GetState();
|
||||
|
|
|
@ -87,27 +87,27 @@ public:
|
|||
bool Run(void);
|
||||
|
||||
inline FGColumnVector3& GetPQR(void) {return vPQR;}
|
||||
inline float GetPQR(int axis) {return vPQR(axis);}
|
||||
inline double GetPQR(int axis) {return vPQR(axis);}
|
||||
inline FGColumnVector3& GetPQRdot(void) {return vPQRdot;}
|
||||
inline float GetPQRdot(int idx) {return vPQRdot(idx);}
|
||||
inline double GetPQRdot(int idx) {return vPQRdot(idx);}
|
||||
inline FGColumnVector3& GetEuler(void) {return vEuler;}
|
||||
inline float GetEuler(int axis) {return vEuler(axis);}
|
||||
inline double GetEuler(int axis) {return vEuler(axis);}
|
||||
inline FGColumnVector3& GetEulerRates(void) { return vEulerRates; }
|
||||
inline float GetEulerRates(int axis) { return vEulerRates(axis); }
|
||||
inline double GetEulerRates(int axis) { return vEulerRates(axis); }
|
||||
inline void SetPQR(FGColumnVector3 tt) {vPQR = tt;}
|
||||
inline void SetEuler(FGColumnVector3 tt) {vEuler = tt;}
|
||||
|
||||
inline float Getphi(void) {return vEuler(1);}
|
||||
inline float Gettht(void) {return vEuler(2);}
|
||||
inline float Getpsi(void) {return vEuler(3);}
|
||||
inline double Getphi(void) {return vEuler(1);}
|
||||
inline double Gettht(void) {return vEuler(2);}
|
||||
inline double Getpsi(void) {return vEuler(3);}
|
||||
|
||||
inline float GetCosphi(void) {return cPhi;}
|
||||
inline float GetCostht(void) {return cTht;}
|
||||
inline float GetCospsi(void) {return cPsi;}
|
||||
inline double GetCosphi(void) {return cPhi;}
|
||||
inline double GetCostht(void) {return cTht;}
|
||||
inline double GetCospsi(void) {return cPsi;}
|
||||
|
||||
inline float GetSinphi(void) {return sPhi;}
|
||||
inline float GetSintht(void) {return sTht;}
|
||||
inline float GetSinpsi(void) {return sPsi;}
|
||||
inline double GetSinphi(void) {return sPhi;}
|
||||
inline double GetSintht(void) {return sTht;}
|
||||
inline double GetSinpsi(void) {return sPsi;}
|
||||
|
||||
private:
|
||||
FGColumnVector3 vPQR;
|
||||
|
@ -117,12 +117,12 @@ private:
|
|||
FGColumnVector3 vEulerRates;
|
||||
FGColumnVector3 vlastPQRdot;
|
||||
|
||||
float cTht,sTht;
|
||||
float cPhi,sPhi;
|
||||
float cPsi,sPsi;
|
||||
double cTht,sTht;
|
||||
double cPhi,sPhi;
|
||||
double cPsi,sPsi;
|
||||
|
||||
float Ixx, Iyy, Izz, Ixz;
|
||||
float dt;
|
||||
double Ixx, Iyy, Izz, Ixz;
|
||||
double dt;
|
||||
|
||||
void GetState(void);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ FGRotor::~FGRotor()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGRotor::Calculate(float PowerAvailable)
|
||||
double FGRotor::Calculate(double PowerAvailable)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
FGRotor(FGFDMExec *FDMExec);
|
||||
~FGRotor();
|
||||
|
||||
float Calculate(float);
|
||||
double Calculate(double);
|
||||
|
||||
private:
|
||||
void Debug(void);
|
||||
|
|
|
@ -166,8 +166,8 @@ FGState::~FGState()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGState::GetParameter(eParam val_idx) {
|
||||
float scratch;
|
||||
double FGState::GetParameter(eParam val_idx) {
|
||||
double scratch;
|
||||
|
||||
switch(val_idx) {
|
||||
case FG_TIME:
|
||||
|
@ -296,7 +296,7 @@ float FGState::GetParameter(eParam val_idx) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGState::GetParameter(string val_string) {
|
||||
double FGState::GetParameter(string val_string) {
|
||||
return GetParameter(coeffdef[val_string]);
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ eParam FGState::GetParameterIndex(string val_string) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGState::SetParameter(eParam val_idx, float val) {
|
||||
void FGState::SetParameter(eParam val_idx, double val) {
|
||||
switch(val_idx) {
|
||||
case FG_ELEVATOR_POS:
|
||||
FCS->SetDePos(val);
|
||||
|
@ -403,10 +403,10 @@ bool FGState::Reset(string path, string acname, string fname)
|
|||
string resetDef;
|
||||
string token="";
|
||||
|
||||
float U, V, W;
|
||||
float phi, tht, psi;
|
||||
float latitude, longitude, h;
|
||||
float wdir, wmag, wnorth, weast;
|
||||
double U, V, W;
|
||||
double phi, tht, psi;
|
||||
double latitude, longitude, h;
|
||||
double wdir, wmag, wnorth, weast;
|
||||
|
||||
# ifndef macintosh
|
||||
resetDef = path + "/" + acname + "/" + fname + ".xml";
|
||||
|
@ -462,13 +462,13 @@ bool FGState::Reset(string path, string acname, string fname)
|
|||
// Initialize: Assume all angles GIVEN IN RADIANS !!
|
||||
//
|
||||
|
||||
void FGState::Initialize(float U, float V, float W,
|
||||
float phi, float tht, float psi,
|
||||
float Latitude, float Longitude, float H,
|
||||
float wnorth, float weast, float wdown)
|
||||
void FGState::Initialize(double U, double V, double W,
|
||||
double phi, double tht, double psi,
|
||||
double Latitude, double Longitude, double H,
|
||||
double wnorth, double weast, double wdown)
|
||||
{
|
||||
float alpha, beta;
|
||||
float qbar, Vt;
|
||||
double alpha, beta;
|
||||
double qbar, Vt;
|
||||
FGColumnVector3 vAero;
|
||||
|
||||
Position->SetLatitude(Latitude);
|
||||
|
@ -516,10 +516,10 @@ void FGState::Initialize(float U, float V, float W,
|
|||
|
||||
void FGState::Initialize(FGInitialCondition *FGIC) {
|
||||
|
||||
float tht,psi,phi;
|
||||
float U, V, W, h;
|
||||
float latitude, longitude;
|
||||
float wnorth,weast, wdown;
|
||||
double tht,psi,phi;
|
||||
double U, V, W, h;
|
||||
double latitude, longitude;
|
||||
double wnorth,weast, wdown;
|
||||
|
||||
latitude = FGIC->GetLatitudeRadIC();
|
||||
longitude = FGIC->GetLongitudeRadIC();
|
||||
|
@ -567,14 +567,14 @@ bool FGState::StoreData(string fname) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGState::InitMatrices(float phi, float tht, float psi) {
|
||||
float thtd2, psid2, phid2;
|
||||
float Sthtd2, Spsid2, Sphid2;
|
||||
float Cthtd2, Cpsid2, Cphid2;
|
||||
float Cphid2Cthtd2;
|
||||
float Cphid2Sthtd2;
|
||||
float Sphid2Sthtd2;
|
||||
float Sphid2Cthtd2;
|
||||
void FGState::InitMatrices(double phi, double tht, double psi) {
|
||||
double thtd2, psid2, phid2;
|
||||
double Sthtd2, Spsid2, Sphid2;
|
||||
double Cthtd2, Cpsid2, Cphid2;
|
||||
double Cphid2Cthtd2;
|
||||
double Cphid2Sthtd2;
|
||||
double Sphid2Sthtd2;
|
||||
double Sphid2Cthtd2;
|
||||
|
||||
thtd2 = tht/2.0;
|
||||
psid2 = psi/2.0;
|
||||
|
@ -604,9 +604,9 @@ void FGState::InitMatrices(float phi, float tht, float psi) {
|
|||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGState::CalcMatrices(void) {
|
||||
float Q0Q0, Q1Q1, Q2Q2, Q3Q3;
|
||||
float Q0Q1, Q0Q2, Q0Q3, Q1Q2;
|
||||
float Q1Q3, Q2Q3;
|
||||
double Q0Q0, Q1Q1, Q2Q2, Q3Q3;
|
||||
double Q0Q1, Q0Q2, Q0Q3, Q1Q2;
|
||||
double Q1Q3, Q2Q3;
|
||||
|
||||
Q0Q0 = vQtrn(1)*vQtrn(1);
|
||||
Q1Q1 = vQtrn(2)*vQtrn(2);
|
||||
|
@ -664,9 +664,12 @@ FGColumnVector3& FGState::CalcEuler(void) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
FGMatrix33& FGState::GetTs2b(float alpha, float beta)
|
||||
FGMatrix33& FGState::GetTs2b(void)
|
||||
{
|
||||
float ca, cb, sa, sb;
|
||||
double ca, cb, sa, sb;
|
||||
|
||||
double alpha = Translation->Getalpha();
|
||||
double beta = Translation->Getbeta();
|
||||
|
||||
ca = cos(alpha);
|
||||
sa = sin(alpha);
|
||||
|
|
|
@ -147,18 +147,18 @@ public:
|
|||
@param weast eastward velocity in feet per second
|
||||
@param wdown downward velocity in feet per second
|
||||
*/
|
||||
void Initialize(float U,
|
||||
float V,
|
||||
float W,
|
||||
float lat,
|
||||
float lon,
|
||||
float phi,
|
||||
float tht,
|
||||
float psi,
|
||||
float h,
|
||||
float wnorth,
|
||||
float weast,
|
||||
float wdown);
|
||||
void Initialize(double U,
|
||||
double V,
|
||||
double W,
|
||||
double lat,
|
||||
double lon,
|
||||
double phi,
|
||||
double tht,
|
||||
double psi,
|
||||
double h,
|
||||
double wnorth,
|
||||
double weast,
|
||||
double wdown);
|
||||
|
||||
/** Initializes the simulation state based on parameters from an Initial Conditions object.
|
||||
@param FGIC pointer to an initial conditions object.
|
||||
|
@ -173,12 +173,12 @@ public:
|
|||
bool StoreData(string filename);
|
||||
|
||||
/// returns the speed of sound in feet per second.
|
||||
inline float Geta(void) { return a; }
|
||||
inline double Geta(void) { return a; }
|
||||
|
||||
/// Returns the simulation time in seconds.
|
||||
inline float Getsim_time(void) { return sim_time; }
|
||||
inline double Getsim_time(void) { return sim_time; }
|
||||
/// Returns the simulation delta T.
|
||||
inline float Getdt(void) { return dt; }
|
||||
inline double Getdt(void) { return dt; }
|
||||
|
||||
/// Suspends the simulation and sets the delta T to zero.
|
||||
inline void Suspend(void) {saved_dt = dt; dt = 0.0;}
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
@param val_idx one of the enumerated JSBSim parameters.
|
||||
@return the value of the parameter.
|
||||
*/
|
||||
float GetParameter(eParam val_idx);
|
||||
double GetParameter(eParam val_idx);
|
||||
|
||||
/** Retrieves a parameter.
|
||||
The parameters that can be retrieved are enumerated in FGJSBBase.h.
|
||||
|
@ -198,7 +198,7 @@ public:
|
|||
i.e. "FG_QBAR".
|
||||
@return the value of the parameter.
|
||||
*/
|
||||
float GetParameter(string val_string);
|
||||
double GetParameter(string val_string);
|
||||
|
||||
/** Retrieves the JSBSim parameter enumerated item given the text string.
|
||||
@param val_string the parameter string, i.e. "FG_QBAR".
|
||||
|
@ -209,13 +209,13 @@ public:
|
|||
/** Sets the speed of sound.
|
||||
@param speed the speed of sound in feet per second.
|
||||
*/
|
||||
inline void Seta(float speed) { a = speed; }
|
||||
inline void Seta(double speed) { a = speed; }
|
||||
|
||||
/** Sets the current sim time.
|
||||
@param cur_time the current time
|
||||
@return the current time.
|
||||
*/
|
||||
inline float Setsim_time(float cur_time) {
|
||||
inline double Setsim_time(double cur_time) {
|
||||
sim_time = cur_time;
|
||||
return sim_time;
|
||||
}
|
||||
|
@ -223,18 +223,18 @@ public:
|
|||
/** Sets the integration time step for the simulation executive.
|
||||
@param delta_t the time step in seconds.
|
||||
*/
|
||||
inline void Setdt(float delta_t) { dt = delta_t; }
|
||||
inline void Setdt(double delta_t) { dt = delta_t; }
|
||||
|
||||
/** Sets the JSBSim parameter to the supplied value.
|
||||
@param prm the JSBSim parameter to set, i.e. FG_RUDDER_POS.
|
||||
@param val the value to give the parameter.
|
||||
*/
|
||||
void SetParameter(eParam prm, float val);
|
||||
void SetParameter(eParam prm, double val);
|
||||
|
||||
/** Increments the simulation time.
|
||||
@return the new simulation time.
|
||||
*/
|
||||
inline float IncrTime(void) {
|
||||
inline double IncrTime(void) {
|
||||
sim_time+=dt;
|
||||
return sim_time;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ public:
|
|||
@param tht the pitch angle in radians.
|
||||
@param psi the heading angle in radians
|
||||
*/
|
||||
void InitMatrices(float phi, float tht, float psi);
|
||||
void InitMatrices(double phi, double tht, double psi);
|
||||
|
||||
/** Calculates the local-to-body and body-to-local conversion matrices.
|
||||
*/
|
||||
|
@ -265,11 +265,9 @@ public:
|
|||
FGColumnVector3& CalcEuler(void);
|
||||
|
||||
/** Calculates and returns the stability-to-body axis transformation matrix.
|
||||
@param alpha angle of attack in radians.
|
||||
@param beta angle of sideslip in radians.
|
||||
@return a reference to the stability-to-body transformation matrix.
|
||||
*/
|
||||
FGMatrix33& GetTs2b(float alpha, float beta);
|
||||
FGMatrix33& GetTs2b(void);
|
||||
|
||||
/** Retrieves the local-to-body transformation matrix.
|
||||
@return a reference to the local-to-body transformation matrix.
|
||||
|
@ -281,7 +279,7 @@ public:
|
|||
@param c matrix column index.
|
||||
@return the matrix element described by the row and column supplied.
|
||||
*/
|
||||
float GetTl2b(int r, int c) { return mTl2b(r,c);}
|
||||
double GetTl2b(int r, int c) { return mTl2b(r,c);}
|
||||
|
||||
/** Retrieves the body-to-local transformation matrix.
|
||||
@return a reference to the body-to-local matrix.
|
||||
|
@ -293,7 +291,7 @@ public:
|
|||
@param c matrix column index.
|
||||
@return the matrix element described by the row and column supplied.
|
||||
*/
|
||||
float GetTb2l(int i, int j) { return mTb2l(i,j);}
|
||||
double GetTb2l(int i, int j) { return mTb2l(i,j);}
|
||||
|
||||
/** Prints a summary of simulator state (speed, altitude,
|
||||
configuration, etc.)
|
||||
|
@ -305,9 +303,9 @@ public:
|
|||
ParamMap paramdef;
|
||||
|
||||
private:
|
||||
float a; // speed of sound
|
||||
float sim_time, dt;
|
||||
float saved_dt;
|
||||
double a; // speed of sound
|
||||
double sim_time, dt;
|
||||
double saved_dt;
|
||||
|
||||
FGFDMExec* FDMExec;
|
||||
FGMatrix33 mTb2l;
|
||||
|
|
|
@ -78,11 +78,11 @@ FGTable::FGTable(int NRows) : nRows(NRows), nCols(1)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float** FGTable::Allocate(void)
|
||||
double** FGTable::Allocate(void)
|
||||
{
|
||||
Data = new float*[nRows+1];
|
||||
Data = new double*[nRows+1];
|
||||
for (int r=0; r<=nRows; r++) {
|
||||
Data[r] = new float[nCols+1];
|
||||
Data[r] = new double[nCols+1];
|
||||
for (int c=0; c<=nCols; c++) {
|
||||
Data[r][c] = 0.0;
|
||||
}
|
||||
|
@ -101,9 +101,9 @@ FGTable::~FGTable()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGTable::GetValue(float key)
|
||||
double FGTable::GetValue(double key)
|
||||
{
|
||||
float Factor, Value, Span;
|
||||
double Factor, Value, Span;
|
||||
int r;
|
||||
|
||||
for (r=1; r<=nRows; r++) if (Data[r][0] >= key) break;
|
||||
|
@ -126,9 +126,9 @@ float FGTable::GetValue(float key)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGTable::GetValue(float rowKey, float colKey)
|
||||
double FGTable::GetValue(double rowKey, double colKey)
|
||||
{
|
||||
float rFactor, cFactor, col1temp, col2temp, Value;
|
||||
double rFactor, cFactor, col1temp, col2temp, Value;
|
||||
int r, c;
|
||||
|
||||
for (r=1;r<=nRows;r++) if (Data[r][0] >= rowKey) break;
|
||||
|
@ -195,13 +195,13 @@ FGTable& FGTable::operator<<(const int n)
|
|||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
FGTable& FGTable::operator<<(const float n)
|
||||
/*
|
||||
FGTable& FGTable::operator<<(const double n)
|
||||
{
|
||||
*this << (double)n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
*/
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGTable::Print(void)
|
||||
|
|
|
@ -78,8 +78,8 @@ public:
|
|||
~FGTable();
|
||||
FGTable(int nRows);
|
||||
FGTable(int nRows, int nCols);
|
||||
float GetValue(float key);
|
||||
float GetValue(float rowKey, float colKey);
|
||||
double GetValue(double key);
|
||||
double GetValue(double rowKey, double colKey);
|
||||
/** Read the table in.
|
||||
Data in the config file should be in matrix format with the row
|
||||
independents as the first column and the column independents in
|
||||
|
@ -92,19 +92,19 @@ public:
|
|||
</pre>
|
||||
*/
|
||||
void operator<<(FGConfigFile&);
|
||||
FGTable& operator<<(const float n);
|
||||
FGTable& operator<<(const int n);
|
||||
FGTable& operator<<(const double n);
|
||||
inline float GetElement(int r, int c) {return Data[r][c];}
|
||||
FGTable& operator<<(const int n);
|
||||
// FGTable& operator<<(const double n);
|
||||
inline double GetElement(int r, int c) {return Data[r][c];}
|
||||
void Print(void);
|
||||
|
||||
private:
|
||||
enum type {tt1D, tt2D} Type;
|
||||
float** Data;
|
||||
double** Data;
|
||||
int nRows, nCols;
|
||||
unsigned int colCounter;
|
||||
unsigned int rowCounter;
|
||||
float** Allocate(void);
|
||||
double** Allocate(void);
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ FGTank::FGTank(FGConfigFile* AC_cfg)
|
|||
else Type = ttUNKNOWN;
|
||||
|
||||
AC_cfg->GetNextConfigLine();
|
||||
while ((token = AC_cfg->GetValue()) != "/AC_TANK") {
|
||||
while ((token = AC_cfg->GetValue()) != string("/AC_TANK")) {
|
||||
if (token == "XLOC") *AC_cfg >> X;
|
||||
else if (token == "YLOC") *AC_cfg >> Y;
|
||||
else if (token == "ZLOC") *AC_cfg >> Z;
|
||||
|
@ -99,9 +99,9 @@ FGTank::~FGTank()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGTank::Reduce(float used)
|
||||
double FGTank::Reduce(double used)
|
||||
{
|
||||
float shortage;
|
||||
double shortage;
|
||||
|
||||
if (used < Contents) {
|
||||
Contents -= used;
|
||||
|
|
|
@ -82,24 +82,24 @@ public:
|
|||
FGTank(FGConfigFile*);
|
||||
~FGTank();
|
||||
|
||||
float Reduce(float);
|
||||
double Reduce(double);
|
||||
int GetType(void) {return Type;}
|
||||
bool GetSelected(void) {return Selected;}
|
||||
float GetPctFull(void) {return PctFull;}
|
||||
float GetContents(void) {return Contents;}
|
||||
float inline GetX(void) {return X;}
|
||||
float inline GetY(void) {return Y;}
|
||||
float inline GetZ(void) {return Z;}
|
||||
double GetPctFull(void) {return PctFull;}
|
||||
double GetContents(void) {return Contents;}
|
||||
double inline GetX(void) {return X;}
|
||||
double inline GetY(void) {return Y;}
|
||||
double inline GetZ(void) {return Z;}
|
||||
|
||||
enum TankType {ttUNKNOWN, ttFUEL, ttOXIDIZER};
|
||||
|
||||
private:
|
||||
TankType Type;
|
||||
float X, Y, Z;
|
||||
float Capacity;
|
||||
float Radius;
|
||||
float PctFull;
|
||||
float Contents;
|
||||
double X, Y, Z;
|
||||
double Capacity;
|
||||
double Radius;
|
||||
double PctFull;
|
||||
double Contents;
|
||||
bool Selected;
|
||||
void Debug(void);
|
||||
};
|
||||
|
|
|
@ -74,21 +74,21 @@ public:
|
|||
|
||||
enum eType {ttNozzle, ttRotor, ttPropeller};
|
||||
|
||||
virtual float Calculate(float) {return 0.0;}
|
||||
virtual double Calculate(double) {return 0.0;}
|
||||
void SetName(string name) {Name = name;}
|
||||
virtual float GetPowerRequired(void) {return 0.0;}
|
||||
virtual void SetdeltaT(float dt) {deltaT = dt;}
|
||||
float GetThrust(void) {return Thrust;}
|
||||
virtual double GetPowerRequired(void) {return 0.0;}
|
||||
virtual void SetdeltaT(double dt) {deltaT = dt;}
|
||||
double GetThrust(void) {return Thrust;}
|
||||
eType GetType(void) {return Type;}
|
||||
string GetName(void) {return Name;}
|
||||
virtual float GetRPM(void) { return 0.0; };
|
||||
virtual double GetRPM(void) { return 0.0; };
|
||||
|
||||
protected:
|
||||
eType Type;
|
||||
string Name;
|
||||
float Thrust;
|
||||
float PowerRequired;
|
||||
float deltaT;
|
||||
double Thrust;
|
||||
double PowerRequired;
|
||||
double deltaT;
|
||||
virtual void Debug(void);
|
||||
};
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ FGTranslation::~FGTranslation()
|
|||
|
||||
bool FGTranslation::Run(void)
|
||||
{
|
||||
float Tc = 0.5*State->Getdt()*rate;
|
||||
double Tc = 0.5*State->Getdt()*rate;
|
||||
|
||||
if (!FGModel::Run()) {
|
||||
|
||||
|
@ -133,8 +133,8 @@ bool FGTranslation::Run(void)
|
|||
sqrt(vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW))) : 0.0;
|
||||
|
||||
// stolen, quite shamelessly, from LaRCsim
|
||||
float mUW = (vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW));
|
||||
float signU=1;
|
||||
double mUW = (vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW));
|
||||
double signU=1;
|
||||
if (vAero(eU) != 0.0)
|
||||
signU = vAero(eU)/fabs(vAero(eU));
|
||||
|
||||
|
|
|
@ -88,31 +88,31 @@ public:
|
|||
~FGTranslation();
|
||||
|
||||
inline FGColumnVector3& GetUVW (void) { return vUVW; }
|
||||
inline float GetUVW (int idx) { return vUVW(idx); }
|
||||
inline double GetUVW (int idx) { return vUVW(idx); }
|
||||
inline FGColumnVector3& GetUVWdot(void) { return vUVWdot; }
|
||||
inline float GetUVWdot(int idx) { return vUVWdot(idx); }
|
||||
inline double GetUVWdot(int idx) { return vUVWdot(idx); }
|
||||
inline FGColumnVector3& GetvAero (void) { return vAero; }
|
||||
inline float GetvAero (int idx) { return vAero(idx); }
|
||||
inline double GetvAero (int idx) { return vAero(idx); }
|
||||
|
||||
inline float Getalpha(void) { return alpha; }
|
||||
inline float Getbeta (void) { return beta; }
|
||||
inline float Getqbar (void) { return qbar; }
|
||||
inline float GetVt (void) { return Vt; }
|
||||
inline float GetMach (void) { return Mach; }
|
||||
inline float Getadot (void) { return adot; }
|
||||
inline float Getbdot (void) { return bdot; }
|
||||
inline double Getalpha(void) { return alpha; }
|
||||
inline double Getbeta (void) { return beta; }
|
||||
inline double Getqbar (void) { return qbar; }
|
||||
inline double GetVt (void) { return Vt; }
|
||||
inline double GetMach (void) { return Mach; }
|
||||
inline double Getadot (void) { return adot; }
|
||||
inline double Getbdot (void) { return bdot; }
|
||||
|
||||
void SetUVW(FGColumnVector3 tt) { vUVW = tt; }
|
||||
|
||||
inline void Setalpha(float tt) { alpha = tt; }
|
||||
inline void Setbeta (float tt) { beta = tt; }
|
||||
inline void Setqbar (float tt) { qbar = tt; }
|
||||
inline void SetVt (float tt) { Vt = tt; }
|
||||
inline void SetMach (float tt) { Mach=tt; }
|
||||
inline void Setadot (float tt) { adot = tt; }
|
||||
inline void Setbdot (float tt) { bdot = tt; }
|
||||
inline void Setalpha(double tt) { alpha = tt; }
|
||||
inline void Setbeta (double tt) { beta = tt; }
|
||||
inline void Setqbar (double tt) { qbar = tt; }
|
||||
inline void SetVt (double tt) { Vt = tt; }
|
||||
inline void SetMach (double tt) { Mach=tt; }
|
||||
inline void Setadot (double tt) { adot = tt; }
|
||||
inline void Setbdot (double tt) { bdot = tt; }
|
||||
|
||||
inline void SetAB(float t1, float t2) { alpha=t1; beta=t2; }
|
||||
inline void SetAB(double t1, double t2) { alpha=t1; beta=t2; }
|
||||
|
||||
bool Run(void);
|
||||
|
||||
|
@ -123,10 +123,10 @@ private:
|
|||
FGMatrix33 mVel;
|
||||
FGColumnVector3 vAero;
|
||||
|
||||
float Vt, qbar, Mach;
|
||||
float dt;
|
||||
float alpha, beta;
|
||||
float adot,bdot;
|
||||
double Vt, qbar, Mach;
|
||||
double dt;
|
||||
double alpha, beta;
|
||||
double adot,bdot;
|
||||
|
||||
void Debug(void);
|
||||
};
|
||||
|
|
|
@ -104,8 +104,8 @@ FGTrim::FGTrim(FGFDMExec *FDMExec,FGInitialCondition *FGIC, TrimMode tt ) {
|
|||
break;
|
||||
}
|
||||
//cout << "TrimAxes.size(): " << TrimAxes.size() << endl;
|
||||
sub_iterations=new float[TrimAxes.size()];
|
||||
successful=new float[TrimAxes.size()];
|
||||
sub_iterations=new double[TrimAxes.size()];
|
||||
successful=new double[TrimAxes.size()];
|
||||
solution=new bool[TrimAxes.size()];
|
||||
current_axis=0;
|
||||
|
||||
|
@ -138,7 +138,7 @@ void FGTrim::TrimStats() {
|
|||
snprintf(out,80," %5s: %3.0f average: %5.2f successful: %3.0f stability: %5.2f\n",
|
||||
TrimAxes[current_axis]->GetStateName().c_str(),
|
||||
sub_iterations[current_axis],
|
||||
sub_iterations[current_axis]/float(total_its),
|
||||
sub_iterations[current_axis]/double(total_its),
|
||||
successful[current_axis],
|
||||
TrimAxes[current_axis]->GetAvgStability() );
|
||||
cout << out;
|
||||
|
@ -192,8 +192,8 @@ bool FGTrim::AddState( State state, Control control ) {
|
|||
delete[] sub_iterations;
|
||||
delete[] successful;
|
||||
delete[] solution;
|
||||
sub_iterations=new float[TrimAxes.size()];
|
||||
successful=new float[TrimAxes.size()];
|
||||
sub_iterations=new double[TrimAxes.size()];
|
||||
successful=new double[TrimAxes.size()];
|
||||
solution=new bool[TrimAxes.size()];
|
||||
}
|
||||
return result;
|
||||
|
@ -221,8 +221,8 @@ bool FGTrim::RemoveState( State state ) {
|
|||
delete[] sub_iterations;
|
||||
delete[] successful;
|
||||
delete[] solution;
|
||||
sub_iterations=new float[TrimAxes.size()];
|
||||
successful=new float[TrimAxes.size()];
|
||||
sub_iterations=new double[TrimAxes.size()];
|
||||
successful=new double[TrimAxes.size()];
|
||||
solution=new bool[TrimAxes.size()];
|
||||
}
|
||||
return result;
|
||||
|
@ -365,9 +365,9 @@ bool FGTrim::DoTrim(void) {
|
|||
|
||||
bool FGTrim::solve(void) {
|
||||
|
||||
float x1,x2,x3,f1,f2,f3,d,d0;
|
||||
const float relax =0.9;
|
||||
float eps=TrimAxes[current_axis]->GetSolverEps();
|
||||
double x1,x2,x3,f1,f2,f3,d,d0;
|
||||
const double relax =0.9;
|
||||
double eps=TrimAxes[current_axis]->GetSolverEps();
|
||||
|
||||
x1=x2=x3=0;
|
||||
d=1;
|
||||
|
@ -446,12 +446,12 @@ bool FGTrim::solve(void) {
|
|||
*/
|
||||
bool FGTrim::findInterval(void) {
|
||||
bool found=false;
|
||||
float step;
|
||||
float current_control=TrimAxes[current_axis]->GetControl();
|
||||
float current_accel=TrimAxes[current_axis]->GetState();;
|
||||
float xmin=TrimAxes[current_axis]->GetControlMin();
|
||||
float xmax=TrimAxes[current_axis]->GetControlMax();
|
||||
float lastxlo,lastxhi,lastalo,lastahi;
|
||||
double step;
|
||||
double current_control=TrimAxes[current_axis]->GetControl();
|
||||
double current_accel=TrimAxes[current_axis]->GetState();;
|
||||
double xmin=TrimAxes[current_axis]->GetControlMin();
|
||||
double xmax=TrimAxes[current_axis]->GetControlMax();
|
||||
double lastxlo,lastxhi,lastalo,lastahi;
|
||||
|
||||
step=0.025*fabs(xmax);
|
||||
xlo=xhi=current_control;
|
||||
|
@ -516,8 +516,8 @@ bool FGTrim::findInterval(void) {
|
|||
|
||||
bool FGTrim::checkLimits(void) {
|
||||
bool solutionExists;
|
||||
float current_control=TrimAxes[current_axis]->GetControl();
|
||||
float current_accel=TrimAxes[current_axis]->GetState();
|
||||
double current_control=TrimAxes[current_axis]->GetControl();
|
||||
double current_accel=TrimAxes[current_axis]->GetState();
|
||||
xlo=TrimAxes[current_axis]->GetControlMin();
|
||||
xhi=TrimAxes[current_axis]->GetControlMax();
|
||||
|
||||
|
|
|
@ -145,11 +145,11 @@ private:
|
|||
int N, Nsub;
|
||||
TrimMode mode;
|
||||
int Debug;
|
||||
float Tolerance, A_Tolerance;
|
||||
float wdot,udot,qdot;
|
||||
float dth;
|
||||
float *sub_iterations;
|
||||
float *successful;
|
||||
double Tolerance, A_Tolerance;
|
||||
double wdot,udot,qdot;
|
||||
double dth;
|
||||
double *sub_iterations;
|
||||
double *successful;
|
||||
bool *solution;
|
||||
int max_sub_iterations;
|
||||
int max_iterations;
|
||||
|
@ -159,7 +159,7 @@ private:
|
|||
bool trim_failed;
|
||||
int axis_count;
|
||||
int solutionDomain;
|
||||
float xlo,xhi,alo,ahi;
|
||||
double xlo,xhi,alo,ahi;
|
||||
|
||||
FGFDMExec* fdmex;
|
||||
FGInitialCondition* fgic;
|
||||
|
@ -261,7 +261,7 @@ public:
|
|||
held to a tolerance of 1/10th of the given. The default is
|
||||
0.001 for the recti-linear accelerations and 0.0001 for the angular.
|
||||
*/
|
||||
inline void SetTolerance(float tt) {
|
||||
inline void SetTolerance(double tt) {
|
||||
Tolerance = tt;
|
||||
A_Tolerance = tt / 10;
|
||||
}
|
||||
|
|
|
@ -186,8 +186,8 @@ void FGTrimAxis::getControl(void) {
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
float FGTrimAxis::computeHmgt(void) {
|
||||
float diff;
|
||||
double FGTrimAxis::computeHmgt(void) {
|
||||
double diff;
|
||||
|
||||
diff = fdmex->GetRotation()->Getpsi() -
|
||||
fdmex->GetPosition()->GetGroundTrack();
|
||||
|
@ -236,7 +236,7 @@ void FGTrimAxis::setControl(void) {
|
|||
// new center of rotation, pick a gear unit as a reference and use its
|
||||
// location vector to calculate the new height change. i.e. new altitude =
|
||||
// earth z component of that vector (which is in body axes )
|
||||
void FGTrimAxis::SetThetaOnGround(float ff) {
|
||||
void FGTrimAxis::SetThetaOnGround(double ff) {
|
||||
int center,i,ref;
|
||||
|
||||
// favor an off-center unit so that the same one can be used for both
|
||||
|
@ -257,12 +257,12 @@ void FGTrimAxis::SetThetaOnGround(float ff) {
|
|||
}
|
||||
cout << "SetThetaOnGround ref gear: " << ref << endl;
|
||||
if(ref >= 0) {
|
||||
float sp=fdmex->GetRotation()->GetSinphi();
|
||||
float cp=fdmex->GetRotation()->GetCosphi();
|
||||
float lx=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1);
|
||||
float ly=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2);
|
||||
float lz=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3);
|
||||
float hagl = -1*lx*sin(ff) +
|
||||
double sp=fdmex->GetRotation()->GetSinphi();
|
||||
double cp=fdmex->GetRotation()->GetCosphi();
|
||||
double lx=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1);
|
||||
double ly=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2);
|
||||
double lz=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3);
|
||||
double hagl = -1*lx*sin(ff) +
|
||||
ly*sp*cos(ff) +
|
||||
lz*cp*cos(ff);
|
||||
|
||||
|
@ -277,9 +277,9 @@ void FGTrimAxis::SetThetaOnGround(float ff) {
|
|||
|
||||
bool FGTrimAxis::initTheta(void) {
|
||||
int i,N,iAft, iForward;
|
||||
float zAft,zForward,zDiff,theta;
|
||||
double zAft,zForward,zDiff,theta;
|
||||
bool level;
|
||||
float saveAlt;
|
||||
double saveAlt;
|
||||
|
||||
saveAlt=fgic->GetAltitudeAGLFtIC();
|
||||
fgic->SetAltitudeAGLFtIC(100);
|
||||
|
@ -337,7 +337,7 @@ bool FGTrimAxis::initTheta(void) {
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
void FGTrimAxis::SetPhiOnGround(float ff) {
|
||||
void FGTrimAxis::SetPhiOnGround(double ff) {
|
||||
int i,ref;
|
||||
|
||||
i=0; ref=-1;
|
||||
|
@ -349,12 +349,12 @@ void FGTrimAxis::SetPhiOnGround(float ff) {
|
|||
i++;
|
||||
}
|
||||
if(ref >= 0) {
|
||||
float st=fdmex->GetRotation()->GetSintht();
|
||||
float ct=fdmex->GetRotation()->GetCostht();
|
||||
float lx=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1);
|
||||
float ly=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2);
|
||||
float lz=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3);
|
||||
float hagl = -1*lx*st +
|
||||
double st=fdmex->GetRotation()->GetSintht();
|
||||
double ct=fdmex->GetRotation()->GetCostht();
|
||||
double lx=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1);
|
||||
double ly=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2);
|
||||
double lz=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3);
|
||||
double hagl = -1*lx*st +
|
||||
ly*sin(ff)*ct +
|
||||
lz*cos(ff)*ct;
|
||||
|
||||
|
@ -368,7 +368,7 @@ void FGTrimAxis::SetPhiOnGround(float ff) {
|
|||
|
||||
void FGTrimAxis::Run(void) {
|
||||
|
||||
float last_state_value;
|
||||
double last_state_value;
|
||||
int i;
|
||||
setControl();
|
||||
//cout << "FGTrimAxis::Run: " << control_value << endl;
|
||||
|
@ -393,7 +393,7 @@ void FGTrimAxis::Run(void) {
|
|||
/*****************************************************************************/
|
||||
|
||||
void FGTrimAxis::setThrottlesPct(void) {
|
||||
float tMin,tMax;
|
||||
double tMin,tMax;
|
||||
for(unsigned i=0;i<fdmex->GetPropulsion()->GetNumEngines();i++) {
|
||||
tMin=fdmex->GetPropulsion()->GetEngine(i)->GetThrottleMin();
|
||||
tMax=fdmex->GetPropulsion()->GetEngine(i)->GetThrottleMax();
|
||||
|
@ -419,9 +419,9 @@ void FGTrimAxis::AxisReport(void) {
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
float FGTrimAxis::GetAvgStability( void ) {
|
||||
double FGTrimAxis::GetAvgStability( void ) {
|
||||
if(total_iterations > 0) {
|
||||
return float(total_stability_iterations)/float(total_iterations);
|
||||
return double(total_stability_iterations)/double(total_iterations);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -82,10 +82,10 @@ public:
|
|||
|
||||
void Run(void);
|
||||
|
||||
float GetState(void) { getState(); return state_value; }
|
||||
double GetState(void) { getState(); return state_value; }
|
||||
//Accels are not settable
|
||||
inline void SetControl(float value ) { control_value=value; }
|
||||
inline float GetControl(void) { return control_value; }
|
||||
inline void SetControl(double value ) { control_value=value; }
|
||||
inline double GetControl(void) { return control_value; }
|
||||
|
||||
inline State GetStateType(void) { return state; }
|
||||
inline Control GetControlType(void) { return control; }
|
||||
|
@ -93,32 +93,32 @@ public:
|
|||
inline string GetStateName(void) { return StateNames[state]; }
|
||||
inline string GetControlName(void) { return ControlNames[control]; }
|
||||
|
||||
inline float GetControlMin(void) { return control_min; }
|
||||
inline float GetControlMax(void) { return control_max; }
|
||||
inline double GetControlMin(void) { return control_min; }
|
||||
inline double GetControlMax(void) { return control_max; }
|
||||
|
||||
inline void SetControlToMin(void) { control_value=control_min; }
|
||||
inline void SetControlToMax(void) { control_value=control_max; }
|
||||
|
||||
inline void SetControlLimits(float min, float max) {
|
||||
inline void SetControlLimits(double min, double max) {
|
||||
control_min=min;
|
||||
control_max=max;
|
||||
}
|
||||
|
||||
inline void SetTolerance(float ff) { tolerance=ff;}
|
||||
inline float GetTolerance(void) { return tolerance; }
|
||||
inline void SetTolerance(double ff) { tolerance=ff;}
|
||||
inline double GetTolerance(void) { return tolerance; }
|
||||
|
||||
inline float GetSolverEps(void) { return solver_eps; }
|
||||
inline void SetSolverEps(float ff) { solver_eps=ff; }
|
||||
inline double GetSolverEps(void) { return solver_eps; }
|
||||
inline void SetSolverEps(double ff) { solver_eps=ff; }
|
||||
|
||||
inline int GetIterationLimit(void) { return max_iterations; }
|
||||
inline void SetIterationLimit(int ii) { max_iterations=ii; }
|
||||
|
||||
inline int GetStability(void) { return its_to_stable_value; }
|
||||
inline int GetRunCount(void) { return total_stability_iterations; }
|
||||
float GetAvgStability( void );
|
||||
double GetAvgStability( void );
|
||||
|
||||
void SetThetaOnGround(float ff);
|
||||
void SetPhiOnGround(float ff);
|
||||
void SetThetaOnGround(double ff);
|
||||
void SetPhiOnGround(double ff);
|
||||
|
||||
bool initTheta(void);
|
||||
|
||||
|
@ -133,18 +133,18 @@ private:
|
|||
State state;
|
||||
Control control;
|
||||
|
||||
float state_value;
|
||||
float control_value;
|
||||
double state_value;
|
||||
double control_value;
|
||||
|
||||
float control_min;
|
||||
float control_max;
|
||||
double control_min;
|
||||
double control_max;
|
||||
|
||||
float tolerance;
|
||||
double tolerance;
|
||||
|
||||
float solver_eps;
|
||||
double solver_eps;
|
||||
|
||||
float state_convert;
|
||||
float control_convert;
|
||||
double state_convert;
|
||||
double control_convert;
|
||||
|
||||
int max_iterations;
|
||||
|
||||
|
@ -158,7 +158,7 @@ private:
|
|||
void getControl(void);
|
||||
void setControl(void);
|
||||
|
||||
float computeHmgt(void);
|
||||
double computeHmgt(void);
|
||||
|
||||
void Debug(void);
|
||||
};
|
||||
|
|
|
@ -62,7 +62,7 @@ FGTurboJet::~FGTurboJet()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGTurboJet::Calculate(float dummy)
|
||||
double FGTurboJet::Calculate(double dummy)
|
||||
{
|
||||
ConsumeFuel();
|
||||
return 0.0;
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
FGTurboJet(FGFDMExec* exec, FGConfigFile* Eng_cfg);
|
||||
~FGTurboJet();
|
||||
|
||||
float Calculate(float);
|
||||
double Calculate(double);
|
||||
|
||||
private:
|
||||
void Debug(void);
|
||||
|
|
|
@ -61,7 +61,7 @@ FGTurboProp::~FGTurboProp()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGTurboProp::Calculate(float dummy)
|
||||
double FGTurboProp::Calculate(double dummy)
|
||||
{
|
||||
ConsumeFuel();
|
||||
return 0.0;
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
FGTurboProp(FGFDMExec* exec, FGConfigFile* Eng_cfg);
|
||||
~FGTurboProp();
|
||||
|
||||
float Calculate(float);
|
||||
double Calculate(double);
|
||||
private:
|
||||
void Debug(void);
|
||||
};
|
||||
|
|
|
@ -61,7 +61,7 @@ FGTurboShaft::~FGTurboShaft()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
float FGTurboShaft::Calculate(float dummy) {
|
||||
double FGTurboShaft::Calculate(double dummy) {
|
||||
ConsumeFuel();
|
||||
return 0.0;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
FGTurboShaft(FGFDMExec* exec, FGConfigFile* Eng_cfg);
|
||||
~FGTurboShaft();
|
||||
|
||||
float Calculate(float);
|
||||
double Calculate(double);
|
||||
private:
|
||||
void Debug(void);
|
||||
};
|
||||
|
|
|
@ -115,7 +115,7 @@ void FGfdmSocket::Append(const char* item)
|
|||
size++;
|
||||
}
|
||||
|
||||
void FGfdmSocket::Append(float item)
|
||||
void FGfdmSocket::Append(double item)
|
||||
{
|
||||
char s[25];
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
~FGfdmSocket();
|
||||
void Send(void);
|
||||
void Append(const char*);
|
||||
void Append(float);
|
||||
void Append(double);
|
||||
void Append(long);
|
||||
void Clear(void);
|
||||
|
||||
|
|
|
@ -133,24 +133,22 @@ int main(int argc, char** argv)
|
|||
|
||||
FDMExec = new FGFDMExec();
|
||||
|
||||
if (scripted) {
|
||||
if (scripted) { // form jsbsim <scriptfile>
|
||||
result = FDMExec->LoadScript(argv[1]);
|
||||
if (!result) {
|
||||
cerr << "Script file " << argv[1] << " was not successfully loaded" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
// result = FDMExec->LoadModel("aircraft", "engine", string(argv[1]));
|
||||
FGInitialCondition IC(FDMExec);
|
||||
result = IC.Load("aircraft","engine",string(argv[1]));
|
||||
|
||||
if (!result) {
|
||||
cerr << "Aircraft file " << argv[1] << " was not found" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
if ( ! FDMExec->GetState()->Reset("aircraft", string(argv[1]), string(argv[2]))) {
|
||||
} else { // form jsbsim <acname> <resetfile>
|
||||
if ( ! FDMExec->LoadModel("aircraft", "engine", string(argv[1]))) {
|
||||
cerr << "JSBSim could not be started" << endl;
|
||||
exit(-1);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
FGInitialCondition IC(FDMExec);
|
||||
if ( ! IC.Load("aircraft",string(argv[1]),string(argv[2]))) {
|
||||
cerr << "Initialization unsuccessful" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
|
||||
virtual bool Run(void);
|
||||
virtual void SetOutput(void);
|
||||
inline float GetOutput (void) {return Output;}
|
||||
inline double GetOutput (void) {return Output;}
|
||||
inline string GetName(void) {return Name;}
|
||||
|
||||
protected:
|
||||
|
@ -110,10 +110,10 @@ protected:
|
|||
string Name;
|
||||
int ID;
|
||||
eParam InputIdx;
|
||||
float Input;
|
||||
double Input;
|
||||
string sOutputIdx;
|
||||
eParam OutputIdx;
|
||||
float Output;
|
||||
double Output;
|
||||
bool IsOutput;
|
||||
virtual void Debug(void);
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ FGFilter::FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
|||
AC_cfg(AC_cfg)
|
||||
{
|
||||
string token;
|
||||
float denom;
|
||||
double denom;
|
||||
|
||||
Type = AC_cfg->GetValue("TYPE");
|
||||
Name = AC_cfg->GetValue("NAME");
|
||||
|
|
|
@ -98,22 +98,22 @@ public:
|
|||
enum {eLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType;
|
||||
|
||||
private:
|
||||
float dt;
|
||||
float ca;
|
||||
float cb;
|
||||
float cc;
|
||||
float cd;
|
||||
float ce;
|
||||
float C1;
|
||||
float C2;
|
||||
float C3;
|
||||
float C4;
|
||||
float C5;
|
||||
float C6;
|
||||
float PreviousInput1;
|
||||
float PreviousInput2;
|
||||
float PreviousOutput1;
|
||||
float PreviousOutput2;
|
||||
double dt;
|
||||
double ca;
|
||||
double cb;
|
||||
double cc;
|
||||
double cd;
|
||||
double ce;
|
||||
double C1;
|
||||
double C2;
|
||||
double C3;
|
||||
double C4;
|
||||
double C5;
|
||||
double C6;
|
||||
double PreviousInput1;
|
||||
double PreviousInput2;
|
||||
double PreviousOutput1;
|
||||
double PreviousOutput2;
|
||||
FGConfigFile* AC_cfg;
|
||||
void Debug(void);
|
||||
};
|
||||
|
|
|
@ -49,8 +49,8 @@ CLASS IMPLEMENTATION
|
|||
FGFlaps::FGFlaps(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
|
||||
AC_cfg(AC_cfg) {
|
||||
string token;
|
||||
float tmpDetent;
|
||||
float tmpTime;
|
||||
double tmpDetent;
|
||||
double tmpTime;
|
||||
|
||||
Detents.clear();
|
||||
TransitionTimes.clear();
|
||||
|
@ -109,8 +109,8 @@ FGFlaps::~FGFlaps()
|
|||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGFlaps::Run(void ) {
|
||||
float dt=fcs->GetState()->Getdt();
|
||||
float flap_transit_rate=0;
|
||||
double dt=fcs->GetState()->Getdt();
|
||||
double flap_transit_rate=0;
|
||||
|
||||
FGFCSComponent::Run(); // call the base class for initialization of Input
|
||||
Flap_Handle = Input*Detents[NumDetents-1];
|
||||
|
|
|
@ -74,12 +74,12 @@ public:
|
|||
|
||||
private:
|
||||
FGConfigFile* AC_cfg;
|
||||
vector<float> Detents;
|
||||
vector<float> TransitionTimes;
|
||||
vector<double> Detents;
|
||||
vector<double> TransitionTimes;
|
||||
int NumDetents,fi;
|
||||
float lastFlapHandle;
|
||||
float Flap_Handle;
|
||||
float Flap_Position;
|
||||
double lastFlapHandle;
|
||||
double Flap_Handle;
|
||||
double Flap_Position;
|
||||
bool Flaps_In_Transit;
|
||||
|
||||
void Debug(void);
|
||||
|
|
|
@ -132,8 +132,8 @@ FGGain::~FGGain()
|
|||
|
||||
bool FGGain::Run(void )
|
||||
{
|
||||
float SchedGain = 1.0;
|
||||
float LookupVal = 0;
|
||||
double SchedGain = 1.0;
|
||||
double LookupVal = 0;
|
||||
|
||||
FGFCSComponent::Run(); // call the base class for initialization of Input
|
||||
|
||||
|
|
|
@ -77,8 +77,8 @@ private:
|
|||
FGConfigFile* AC_cfg;
|
||||
FGTable* Table;
|
||||
FGState* State;
|
||||
float Gain;
|
||||
float Min, Max;
|
||||
double Gain;
|
||||
double Min, Max;
|
||||
int Rows;
|
||||
eParam ScheduledBy;
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ private:
|
|||
vector <eParam> InputIndices;
|
||||
vector <int> InputTypes;
|
||||
bool clip;
|
||||
float clipmin,clipmax;
|
||||
double clipmin,clipmax;
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue