1
0
Fork 0

Synced with latest JSBSim cvs.

This commit is contained in:
curt 2001-11-20 22:34:24 +00:00
parent 3d1e802b84
commit d19ef5cd99
86 changed files with 1436 additions and 1361 deletions

View file

@ -259,6 +259,28 @@ bool FGJSBsim::update( int multiloop ) {
fdmex->Run(); 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++ ) { for( i=0; i<get_num_engines(); i++ ) {
FGEngInterface * e = get_engine(i); FGEngInterface * e = get_engine(i);
FGEngine * eng = Propulsion->GetEngine(i); FGEngine * eng = Propulsion->GetEngine(i);

View file

@ -88,14 +88,10 @@ FGAerodynamics::~FGAerodynamics()
bool FGAerodynamics::Run(void) bool FGAerodynamics::Run(void)
{ {
float alpha, beta;
unsigned int axis_ctr,ctr; unsigned int axis_ctr,ctr;
if (!FGModel::Run()) { if (!FGModel::Run()) {
alpha = Translation->Getalpha();
beta = Translation->Getbeta();
vLastFs = vFs; vLastFs = vFs;
vFs.InitMatrix(); 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) vDXYZcg(eX) = -(Aircraft->GetXYZrp(eX)
- MassBalance->GetXYZcg(eX))*inchtoft; - MassBalance->GetXYZcg(eX))*inchtoft;
@ -135,12 +131,12 @@ bool FGAerodynamics::Load(FGConfigFile* AC_cfg)
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/AERODYNAMICS") { while ((token = AC_cfg->GetValue()) != string("/AERODYNAMICS")) {
if (token == "AXIS") { if (token == "AXIS") {
CoeffArray ca; CoeffArray ca;
axis = AC_cfg->GetValue("NAME"); axis = AC_cfg->GetValue("NAME");
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/AXIS") { while ((token = AC_cfg->GetValue()) != string("/AXIS")) {
if( token == "COEFFICIENT" ) { if( token == "COEFFICIENT" ) {
ca.push_back( new FGCoefficient(FDMExec) ); ca.push_back( new FGCoefficient(FDMExec) );
ca.back()->Load(AC_cfg); 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) { if (fabs(Position->GetGamma()) < 1.57) {
return (vFs(eZ)/(MassBalance->GetWeight()*cos(Position->GetGamma()))); 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); if (vFs(1) != 0.00) return vFs(3)/vFs(1);
else return 0.00; else return 0.00;

View file

@ -112,18 +112,18 @@ public:
/** Gets the total aerodynamic force vector. /** Gets the total aerodynamic force vector.
@return a force vector reference. */ @return a force vector reference. */
FGColumnVector3& GetForces(void) {return vForces;} 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. /** Gets the total aerodynamic moment vector.
@return a moment vector reference. */ @return a moment vector reference. */
FGColumnVector3& GetMoments(void) {return vMoments;} 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 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 FGColumnVector3& GetvFs(void) { return vFs; }
inline float GetvFs(int axis) { return vFs(axis); } inline double GetvFs(int axis) { return vFs(axis); }
float GetLoD(void); double GetLoD(void);
/** Gets the strings for the current set of coefficients. /** Gets the strings for the current set of coefficients.
@return a string containing the descriptive names for all coefficients */ @return a string containing the descriptive names for all coefficients */
@ -135,7 +135,7 @@ public:
string GetCoefficientValues(void); string GetCoefficientValues(void);
/// Gets the Normal Load Factor /// Gets the Normal Load Factor
float GetNlf(void); double GetNlf(void);
private: private:
typedef map<string,int> AxisIndex; typedef map<string,int> AxisIndex;

View file

@ -134,8 +134,8 @@ bool FGAircraft::Load(FGConfigFile* AC_cfg)
ReadPrologue(AC_cfg); ReadPrologue(AC_cfg);
while ((AC_cfg->GetNextConfigLine() != "EOF") && while ((AC_cfg->GetNextConfigLine() != string("EOF")) &&
(token = AC_cfg->GetValue()) != "/FDM_CONFIG") { (token = AC_cfg->GetValue()) != string("/FDM_CONFIG")) {
if (token == "METRICS") { if (token == "METRICS") {
if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl; if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
ReadMetrics(AC_cfg); 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) void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg)
{ {
string token = ""; string token = "";
string parameter; string parameter;
float EW, bixx, biyy, bizz, bixz, biyz; double EW, bixx, biyy, bizz, bixz, biyz;
FGColumnVector3 vbaseXYZcg(3); FGColumnVector3 vbaseXYZcg(3);
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/METRICS") { while ((token = AC_cfg->GetValue()) != string("/METRICS")) {
*AC_cfg >> parameter; *AC_cfg >> parameter;
if (parameter == "AC_WINGAREA") { if (parameter == "AC_WINGAREA") {
*AC_cfg >> WingArea; *AC_cfg >> WingArea;
@ -325,100 +349,8 @@ void FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg)
void FGAircraft::ReadOutput(FGConfigFile* AC_cfg) void FGAircraft::ReadOutput(FGConfigFile* AC_cfg)
{ {
string token, parameter; if (!Output->Load(AC_cfg)) {
int OutRate = 0; cerr << "Output not successfully loaded" << endl;
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;
} }
} }

View file

@ -172,53 +172,36 @@ public:
inline string GetAircraftName(void) { return AircraftName; } inline string GetAircraftName(void) { return AircraftName; }
/// Gets the wing area /// Gets the wing area
inline float GetWingArea(void) { return WingArea; } inline double GetWingArea(void) { return WingArea; }
/// Gets the wing span /// Gets the wing span
inline float GetWingSpan(void) { return WingSpan; } inline double GetWingSpan(void) { return WingSpan; }
/// Gets the average wing chord /// Gets the average wing chord
inline float Getcbar(void) { return cbar; } inline double Getcbar(void) { return cbar; }
inline float GetWingIncidence(void) { return WingIncidence; } inline double GetWingIncidence(void) { return WingIncidence; }
inline float GetHTailArea(void) { return HTailArea; } inline double GetHTailArea(void) { return HTailArea; }
inline float GetHTailArm(void) { return HTailArm; } inline double GetHTailArm(void) { return HTailArm; }
inline float GetVTailArea(void) { return VTailArea; } inline double GetVTailArea(void) { return VTailArea; }
inline float GetVTailArm(void) { return VTailArm; } inline double GetVTailArm(void) { return VTailArm; }
inline float Getlbarh(void) { return lbarh; } // HTailArm / cbar inline double Getlbarh(void) { return lbarh; } // HTailArm / cbar
inline float Getlbarv(void) { return lbarv; } // VTailArm / cbar inline double Getlbarv(void) { return lbarv; } // VTailArm / cbar
inline float Getvbarh(void) { return vbarh; } // H. Tail Volume inline double Getvbarh(void) { return vbarh; } // H. Tail Volume
inline float Getvbarv(void) { return vbarv; } // V. Tail Volume inline double Getvbarv(void) { return vbarv; } // V. Tail Volume
inline FGColumnVector3& GetMoments(void) { return vMoments; } inline FGColumnVector3& GetMoments(void) { return vMoments; }
inline FGColumnVector3& GetForces(void) { return vForces; } inline FGColumnVector3& GetForces(void) { return vForces; }
inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; } inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
inline FGColumnVector3& GetNcg (void) { return vNcg; } inline FGColumnVector3& GetNcg (void) { return vNcg; }
inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; } inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
inline FGColumnVector3& GetXYZep(void) { return vXYZep; } inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
inline float GetXYZrp(int idx) { return vXYZrp(idx); } inline double GetXYZrp(int idx) { return vXYZrp(idx); }
inline float GetXYZep(int idx) { return vXYZep(idx); } inline double GetXYZep(int idx) { return vXYZep(idx); }
inline float GetAlphaCLMax(void) { return alphaclmax; } inline double GetAlphaCLMax(void) { return alphaclmax; }
inline float GetAlphaCLMin(void) { return alphaclmin; } inline double GetAlphaCLMin(void) { return alphaclmin; }
inline void SetAlphaCLMax(float tt) { alphaclmax=tt; } inline void SetAlphaCLMax(double tt) { alphaclmax=tt; }
inline void SetAlphaCLMin(float tt) { alphaclmin=tt; } inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
inline bool GetStallWarn(void) { return impending_stall; } 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: private:
FGColumnVector3 vMoments; FGColumnVector3 vMoments;
FGColumnVector3 vForces; FGColumnVector3 vForces;
@ -229,11 +212,11 @@ private:
FGColumnVector3 vBodyAccel; FGColumnVector3 vBodyAccel;
FGColumnVector3 vNcg; FGColumnVector3 vNcg;
float WingArea, WingSpan, cbar, WingIncidence; double WingArea, WingSpan, cbar, WingIncidence;
float HTailArea, VTailArea, HTailArm, VTailArm; double HTailArea, VTailArea, HTailArm, VTailArm;
float lbarh,lbarv,vbarh,vbarv; double lbarh,lbarv,vbarh,vbarv;
float alphaclmax,alphaclmin; double alphaclmax,alphaclmin;
float impending_stall; double impending_stall;
string CFGVersion; string CFGVersion;
string AircraftName; string AircraftName;

View file

@ -135,19 +135,19 @@ bool FGAtmosphere::Run(void)
soundspeed = sqrt(SHRatio*Reng*temperature); soundspeed = sqrt(SHRatio*Reng*temperature);
State->Seta(soundspeed); State->Seta(soundspeed);
} else { // skip Run() execution this time } else { // skip Run() execution this time
} }
return false; return false;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAtmosphere::Calculate(float altitude) void FGAtmosphere::Calculate(double altitude)
{ {
//see reference [1] //see reference [1]
float slope,reftemp,refpress; double slope,reftemp,refpress;
int i=0; bool lookup = false; int i=0; bool lookup = false;
// cout << "Atmosphere: h=" << altitude << " rho= " << density << endl; // cout << "Atmosphere: h=" << altitude << " rho= " << density << endl;
i=lastIndex; i=lastIndex;

View file

@ -91,32 +91,32 @@ public:
bool InitModel(void); bool InitModel(void);
/// Returns the temperature in degrees Rankine. /// 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. /** Returns the density in slugs/ft^3.
<i>This function may <b>only</b> be used if Run() is called first.</i> */ <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. /// 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. /// 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. /// 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 /// 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. /// 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. /// 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. /// 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. /// 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. /// 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. /// 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. /// Tells the simulator to use an externally calculated atmosphere model.
inline void UseExternal(void) { useExternal=true; } inline void UseExternal(void) { useExternal=true; }
@ -126,21 +126,21 @@ public:
bool External(void) { return useExternal; } bool External(void) { return useExternal; }
/// Provides the external atmosphere model with an interface to set the temperature. /// 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. /// 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. /// 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. /// 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. /// Retrieves the wind components in NED frame.
inline FGColumnVector3& GetWindNED(void) { return vWindNED; } inline FGColumnVector3& GetWindNED(void) { return vWindNED; }
/** Retrieves the wind direction. The direction is defined as north=0 and /** Retrieves the wind direction. The direction is defined as north=0 and
increases counterclockwise. The wind heading is returned in radians.*/ increases counterclockwise. The wind heading is returned in radians.*/
inline float GetWindPsi(void) { return psiw; } inline double GetWindPsi(void) { return psiw; }
private: private:
double rho; double rho;
@ -157,7 +157,7 @@ private:
FGColumnVector3 vWindNED; FGColumnVector3 vWindNED;
double psiw; double psiw;
void Calculate(float altitude); void Calculate(double altitude);
void Debug(void); void Debug(void);
}; };

View file

@ -86,7 +86,7 @@ FGAuxiliary::~FGAuxiliary()
bool FGAuxiliary::Run() bool FGAuxiliary::Run()
{ {
float A,B,D; double A,B,D;
if (!FGModel::Run()) { if (!FGModel::Run()) {
GetState(); 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(); psiw = Atmosphere->GetWindPsi();
psi = Rotation->Getpsi(); 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(); psiw = Atmosphere->GetWindPsi();
psi = Rotation->Getpsi(); 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); return (vPilotAccel/Inertial->gravity())(idx);
} }

View file

@ -85,26 +85,26 @@ public:
bool Run(void); bool Run(void);
// Use FGInitialCondition to set these speeds // Use FGInitialCondition to set these speeds
inline float GetVcalibratedFPS(void) { return vcas; } inline double GetVcalibratedFPS(void) { return vcas; }
inline float GetVcalibratedKTS(void) { return vcas*fpstokts; } inline double GetVcalibratedKTS(void) { return vcas*fpstokts; }
inline float GetVequivalentFPS(void) { return veas; } inline double GetVequivalentFPS(void) { return veas; }
inline float GetVequivalentKTS(void) { return veas*fpstokts; } inline double GetVequivalentKTS(void) { return veas*fpstokts; }
inline FGColumnVector3& GetPilotAccel(void) { return vPilotAccel; } 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); 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); double GetHeadWind(void);
float GetCrossWind(void); double GetCrossWind(void);
private: private:
float vcas; double vcas;
float veas; double veas;
float mach; double mach;
float qbar,rhosl,rho,p,psl,pt; double qbar,rhosl,rho,p,psl,pt;
// Don't add a getter for pt! // Don't add a getter for pt!
// pt above is freestream total pressure for subsonic only // pt above is freestream total pressure for subsonic only
@ -116,7 +116,7 @@ private:
FGColumnVector3 vPilotAccel; FGColumnVector3 vPilotAccel;
FGColumnVector3 vToEyePt; FGColumnVector3 vToEyePt;
float earthPosAngle; double earthPosAngle;
void GetState(void); void GetState(void);
void Debug(void); void Debug(void);

View file

@ -140,7 +140,7 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg) {
n = multparms.find("|"); n = multparms.find("|");
start = 0; start = 0;
if(multparms != "FG_NONE") { if (multparms != string("FG_NONE")) {
while (n < end && n >= 0) { while (n < end && n >= 0) {
n -= start; n -= start;
mult = multparms.substr(start,n); 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; unsigned int midx;
SD = Value = Table->GetValue(rVal, cVal); 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); 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; SD = Value = StaticValue;
@ -222,7 +222,7 @@ float FGCoefficient::Value(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGCoefficient::TotalValue() double FGCoefficient::TotalValue()
{ {
switch(type) { switch(type) {

View file

@ -104,9 +104,9 @@ public:
virtual bool Load(FGConfigFile* AC_cfg); virtual bool Load(FGConfigFile* AC_cfg);
typedef vector <eParam> MultVec; typedef vector <eParam> MultVec;
virtual float TotalValue(void); virtual double TotalValue(void);
virtual inline string Getname(void) {return name;} 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;} inline MultVec Getmultipliers(void) {return multipliers;}
void DumpSD(void); void DumpSD(void);
@ -126,15 +126,15 @@ private:
string description; string description;
string name; string name;
string method; string method;
float Value(float, float); double Value(double, double);
float Value(float); double Value(double);
float Value(void); double Value(void);
float StaticValue; double StaticValue;
eParam LookupR, LookupC; eParam LookupR, LookupC;
MultVec multipliers; MultVec multipliers;
int rows, columns; int rows, columns;
Type type; Type type;
float SD; // Actual stability derivative (or other coefficient) value double SD; // Actual stability derivative (or other coefficient) value
FGTable *Table; FGTable *Table;
FGFDMExec* FDMExec; FGFDMExec* FDMExec;

View file

@ -218,7 +218,7 @@ FGColumnVector3 operator*(const double scalar, const FGColumnVector3& C)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGColumnVector3::Magnitude(void) double FGColumnVector3::Magnitude(void)
{ {
double num; 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; data[rowCtr] = ff;
if (++rowCtr > 3 ) if (++rowCtr > 3 )

View file

@ -95,12 +95,12 @@ public:
void operator*=(const double scalar); void operator*=(const double scalar);
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(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); FGColumnVector3 Normalize(void);
friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A); friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A);

View file

@ -204,7 +204,7 @@ FGColumnVector4 operator*(const double scalar, const FGColumnVector4& C)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGColumnVector4::Magnitude(void) double FGColumnVector4::Magnitude(void)
{ {
double num; 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; data[rowCtr] = ff;
if (++rowCtr > 4 ) if (++rowCtr > 4 )

View file

@ -95,12 +95,12 @@ public:
inline double operator()(int m) const { return data[m]; } inline double operator()(int m) const { return data[m]; }
inline double& operator()(int m) { 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(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); FGColumnVector4 Normalize(void);
friend FGColumnVector4 operator*(const double scalar, const FGColumnVector4& A); friend FGColumnVector4 operator*(const double scalar, const FGColumnVector4& A);

View file

@ -60,34 +60,56 @@ FGConfigFile::~FGConfigFile()
string FGConfigFile::GetNextConfigLine(void) 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 { do {
CurrentLine = GetLine(); CurrentLine = GetLine();
if (CurrentLine.find("<!--") != CurrentLine.npos) { line_length = CurrentLine.length();
CommentsOn = true; comment_starts_at = CurrentLine.find("<!--");
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 = "";
}
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; CommentsOn = false;
comment_length = comment_ends_at + 2 - comment_starts_at + 1;
if (CurrentLine.find("-->") != CurrentLine.npos) LineComment = CurrentLine.substr(comment_starts_at+4, comment_length-4-3);
CurrentLine.erase(CurrentLine.find("-->"),4); CurrentLine.erase(comment_starts_at, comment_length);
} else if ( start_comment && !end_comment) { // <!-- ...
while((deblank = CurrentLine.find(" ")) != CurrentLine.npos) CurrentLine.erase(deblank,1); CommentsOn = true;
if (CurrentLine.size() <= 2) CurrentLine = ""; comment_length = line_length - comment_starts_at;
CommentStringTemp = CurrentLine.substr(comment_starts_at+4, comment_length-4);
CommentString += CurrentLine; CommentString = CommentStringTemp + "\r\n";
GetNextConfigLine(); 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); } while (CommentsOn);
if (CurrentLine.length() == 0) GetNextConfigLine(); if (CurrentLine.length() == 0) GetNextConfigLine();
@ -97,13 +119,6 @@ string FGConfigFile::GetNextConfigLine(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGConfigFile::GetCommentString(void)
{
return CommentString;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGConfigFile::GetValue(string val) string FGConfigFile::GetValue(string val)
{ {
unsigned int pos, p1, p2, ptest; unsigned int pos, p1, p2, ptest;
@ -186,14 +201,18 @@ string FGConfigFile::GetLine(void)
int test; int test;
while ((test = cfgfile.get()) != EOF) { while ((test = cfgfile.get()) != EOF) {
if (test >= 0x20) { if (test >= 0x20 || test == 0x09) {
scratch += (char)test; if (test == 0x09) {
scratch += (char)0x20;
} else {
scratch += (char)test;
}
} else { } else {
if ((test = cfgfile.get()) != EOF) { if ((test = cfgfile.get()) != EOF) { // get *next* character
#if defined ( sgi ) && !defined( __GNUC__ ) #if defined ( sgi ) && !defined( __GNUC__ )
if (test >= 0x20) cfgfile.putback(test); if (test >= 0x20 || test == 0x09) cfgfile.putback(test);
#else #else
if (test >= 0x20) cfgfile.unget(); if (test >= 0x20 || test == 0x09) cfgfile.unget();
#endif #endif
break; break;
} }
@ -204,7 +223,7 @@ string FGConfigFile::GetLine(void)
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/*
FGConfigFile& FGConfigFile::operator>>(double& val) FGConfigFile& FGConfigFile::operator>>(double& val)
{ {
unsigned int pos, end; unsigned int pos, end;
@ -219,10 +238,10 @@ FGConfigFile& FGConfigFile::operator>>(double& val)
if (CurrentIndex >= CurrentLine.length()) GetNextConfigLine(); if (CurrentIndex >= CurrentLine.length()) GetNextConfigLine();
return *this; return *this;
} }
*/
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGConfigFile& FGConfigFile::operator>>(float& val) FGConfigFile& FGConfigFile::operator>>(double& val)
{ {
unsigned int pos, end; unsigned int pos, end;

View file

@ -116,10 +116,11 @@ public:
string GetNextConfigLine(void); string GetNextConfigLine(void);
string GetValue(string); string GetValue(string);
string GetValue(void); string GetValue(void);
string GetCommentString(void); string GetCommentString(void) {return CommentString;}
string GetLineComment(void) {return LineComment;}
bool IsOpen(void) {return Opened;} bool IsOpen(void) {return Opened;}
// FGConfigFile& operator>>(double&);
FGConfigFile& operator>>(double&); FGConfigFile& operator>>(double&);
FGConfigFile& operator>>(float&);
FGConfigFile& operator>>(int&); FGConfigFile& operator>>(int&);
FGConfigFile& operator>>(string&); FGConfigFile& operator>>(string&);
FGConfigFile& operator>>(eParam&); FGConfigFile& operator>>(eParam&);
@ -129,6 +130,7 @@ private:
ifstream cfgfile; ifstream cfgfile;
string CurrentLine; string CurrentLine;
string CommentString; string CommentString;
string LineComment;
bool CommentsOn; bool CommentsOn;
bool Opened; bool Opened;
unsigned int CurrentIndex; unsigned int CurrentIndex;

View file

@ -102,11 +102,10 @@ FGEngine::~FGEngine()
// and sets the starved flag if necessary. // and sets the starved flag if necessary.
void FGEngine::ConsumeFuel(void) { void FGEngine::ConsumeFuel(void) {
float Fshortage, Oshortage; double Fshortage, Oshortage;
FGTank* Tank; FGTank* Tank;
if (TrimMode) return; if (TrimMode) return;
Fshortage = Oshortage = 0.0; Fshortage = Oshortage = 0.0;
for (unsigned int i=0; i<SourceTanks.size(); i++) { for (unsigned int i=0; i<SourceTanks.size(); i++) {
Tank = Propulsion->GetTank(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(); FuelNeed = SLFuelFlowMax*PctPower*State->Getdt()*Propulsion->GetRate();
return FuelNeed; return FuelNeed;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGEngine::CalcOxidizerNeed(void) { double FGEngine::CalcOxidizerNeed(void) {
OxidizerNeed = SLOxiFlowMax*PctPower*State->Getdt()*Propulsion->GetRate(); OxidizerNeed = SLOxiFlowMax*PctPower*State->Getdt()*Propulsion->GetRate();
return OxidizerNeed; 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; X = x;
Y = y; Y = y;
Z = z; Z = z;

View file

@ -113,13 +113,13 @@ public:
enum EngineType {etUnknown, etRocket, etPiston, etTurboProp, etTurboJet, etTurboShaft}; enum EngineType {etUnknown, etRocket, etPiston, etTurboProp, etTurboJet, etTurboShaft};
virtual float GetThrottleMin(void) { return MinThrottle; } virtual double GetThrottleMin(void) { return MinThrottle; }
virtual float GetThrottleMax(void) { return MaxThrottle; } virtual double GetThrottleMax(void) { return MaxThrottle; }
float GetThrottle(void) { return Throttle; } double GetThrottle(void) { return Throttle; }
float GetMixture(void) { return Mixture; } double GetMixture(void) { return Mixture; }
int GetMagnetos(void) { return Magnetos; } int GetMagnetos(void) { return Magnetos; }
bool GetStarter(void) { return Starter; } bool GetStarter(void) { return Starter; }
float GetThrust(void) { return Thrust; } double GetThrust(void) { return Thrust; }
bool GetStarved(void) { return Starved; } bool GetStarved(void) { return Starved; }
bool GetFlameout(void) { return Flameout; } bool GetFlameout(void) { return Flameout; }
bool GetRunning(void) { return Running; } bool GetRunning(void) { return Running; }
@ -127,19 +127,19 @@ public:
int GetType(void) { return Type; } int GetType(void) { return Type; }
string GetName(void) { return Name; } string GetName(void) { return Name; }
virtual float getManifoldPressure_inHg () const { virtual double getManifoldPressure_inHg () const {
return ManifoldPressure_inHg; return ManifoldPressure_inHg;
} }
virtual float getExhaustGasTemp_degF () const { virtual double getExhaustGasTemp_degF () const {
return (ExhaustGasTemp_degK - 273) * (9.0 / 5.0) + 32.0; 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; return (CylinderHeadTemp_degK - 273) * (9.0 / 5.0) + 32.0;
} }
virtual float getOilPressure_psi () const { virtual double getOilPressure_psi () const {
return OilPressure_psi; return OilPressure_psi;
} }
virtual float getOilTemp_degF () const { virtual double getOilTemp_degF () const {
return (OilTemp_degK - 273.0) * (9.0 / 5.0) + 32.0; 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 such as a propeller. This resisting effect must be provided to the
engine model. engine model.
@return Thrust in pounds */ @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. /** Reduces the fuel in the active tanks by the amount required.
This function should be called from within the 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) power level. It is also turned from a rate into an actual amount (pounds)
by multiplying it by the delta T and the rate. by multiplying it by the delta T and the rate.
@return Total fuel requirement for this engine in pounds. */ @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 /** 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) power level. It is also turned from a rate into an actual amount (pounds)
by multiplying it by the delta T and the rate. by multiplying it by the delta T and the rate.
@return Total oxidizer requirement for this engine in pounds. */ @return Total oxidizer requirement for this engine in pounds. */
float CalcOxidizerNeed(void); double CalcOxidizerNeed(void);
/// Sets engine placement information /// 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;} bool GetTrimMode(void) {return TrimMode;}
void SetTrimMode(bool state) {TrimMode = state;} void SetTrimMode(bool state) {TrimMode = state;}
@ -190,33 +190,33 @@ public:
protected: protected:
string Name; string Name;
EngineType Type; EngineType Type;
float X, Y, Z; double X, Y, Z;
float EnginePitch; double EnginePitch;
float EngineYaw; double EngineYaw;
float SLFuelFlowMax; double SLFuelFlowMax;
float SLOxiFlowMax; double SLOxiFlowMax;
float MaxThrottle; double MaxThrottle;
float MinThrottle; double MinThrottle;
float Thrust; double Thrust;
float Throttle; double Throttle;
float Mixture; double Mixture;
int Magnetos; int Magnetos;
bool Starter; bool Starter;
float FuelNeed, OxidizerNeed; double FuelNeed, OxidizerNeed;
bool Starved; bool Starved;
bool Flameout; bool Flameout;
bool Running; bool Running;
bool Cranking; bool Cranking;
float PctPower; double PctPower;
int EngineNumber; int EngineNumber;
bool TrimMode; bool TrimMode;
float ManifoldPressure_inHg; double ManifoldPressure_inHg;
float ExhaustGasTemp_degK; double ExhaustGasTemp_degK;
float CylinderHeadTemp_degK; double CylinderHeadTemp_degK;
float OilPressure_psi; double OilPressure_psi;
float OilTemp_degK; double OilTemp_degK;
FGFDMExec* FDMExec; FGFDMExec* FDMExec;
FGState* State; FGState* State;

View file

@ -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; unsigned int ctr;
if ((int)ThrottleCmd.size() > engineNum) { if (engineNum < (int)ThrottlePos.size()) {
if (engineNum < 0) { if (engineNum < 0) {
for (ctr=0;ctr<=ThrottleCmd.size();ctr++) ThrottleCmd[ctr] = setting; for (ctr=0;ctr<ThrottleCmd.size();ctr++) ThrottleCmd[ctr] = setting;
} else { } else {
ThrottleCmd[engineNum] = setting; 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; unsigned int ctr;
if ((int)ThrottlePos.size() > engineNum) { if (engineNum < (int)ThrottlePos.size()) {
if (engineNum < 0) { if (engineNum < 0) {
for (ctr=0;ctr<=ThrottlePos.size();ctr++) ThrottlePos[ctr] = setting; for (ctr=0;ctr<ThrottlePos.size();ctr++) ThrottlePos[ctr] = setting;
} else { } else {
ThrottlePos[engineNum] = setting; 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) { if (engineNum < 0) {
cerr << "Cannot get throttle value for ALL engines" << endl; cerr << "Cannot get throttle value for ALL engines" << endl;
} else { } 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) { if (engineNum < 0) {
cerr << "Cannot get throttle value for ALL engines" << endl; cerr << "Cannot get throttle value for ALL engines" << endl;
} else { } 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; unsigned int ctr;
if (engineNum < 0) { if (engineNum < (int)ThrottlePos.size()) {
for (ctr=0;ctr<MixtureCmd.size();ctr++) MixtureCmd[ctr] = setting; if (engineNum < 0) {
} else { for (ctr=0;ctr<MixtureCmd.size();ctr++) MixtureCmd[ctr] = setting;
MixtureCmd[engineNum] = setting; } else {
MixtureCmd[engineNum] = setting;
}
} }
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGFCS::SetMixturePos(int engineNum, float setting) void FGFCS::SetMixturePos(int engineNum, double setting)
{ {
unsigned int ctr; unsigned int ctr;
if (engineNum < 0) { if (engineNum < (int)ThrottlePos.size()) {
for (ctr=0;ctr<=MixtureCmd.size();ctr++) MixturePos[ctr] = MixtureCmd[ctr]; if (engineNum < 0) {
} else { for (ctr=0;ctr<=MixtureCmd.size();ctr++) MixturePos[ctr] = MixtureCmd[ctr];
MixturePos[engineNum] = setting; } else {
MixturePos[engineNum] = setting;
}
} }
} }
@ -212,7 +216,7 @@ bool FGFCS::Load(FGConfigFile* AC_cfg)
Name = Name + ":" + AC_cfg->GetValue("NAME"); Name = Name + ":" + AC_cfg->GetValue("NAME");
if (debug_lvl > 0) cout << " Control System Name: " << Name << endl; if (debug_lvl > 0) cout << " Control System Name: " << Name << endl;
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/FLIGHT_CONTROL") { while ((token = AC_cfg->GetValue()) != string("/FLIGHT_CONTROL")) {
if (token == "COMPONENT") { if (token == "COMPONENT") {
token = AC_cfg->GetValue("TYPE"); token = AC_cfg->GetValue("TYPE");
if (debug_lvl > 0) cout << " Loading Component \"" 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(); 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) { switch (bg) {
case FGLGear::bgLeft: case FGLGear::bgLeft:
return LeftBrake; return LeftBrake;

View file

@ -171,78 +171,78 @@ public:
//@{ //@{
/** Gets the aileron command. /** Gets the aileron command.
@return aileron command in radians */ @return aileron command in radians */
inline float GetDaCmd(void) { return DaCmd; } inline double GetDaCmd(void) { return DaCmd; }
/** Gets the elevator command. /** Gets the elevator command.
@return elevator command in radians */ @return elevator command in radians */
inline float GetDeCmd(void) { return DeCmd; } inline double GetDeCmd(void) { return DeCmd; }
/** Gets the rudder command. /** Gets the rudder command.
@return rudder command in radians */ @return rudder command in radians */
inline float GetDrCmd(void) { return DrCmd; } inline double GetDrCmd(void) { return DrCmd; }
/** Gets the flaps command. /** Gets the flaps command.
@return flaps command in radians */ @return flaps command in radians */
inline float GetDfCmd(void) { return DfCmd; } inline double GetDfCmd(void) { return DfCmd; }
/** Gets the speedbrake command. /** Gets the speedbrake command.
@return speedbrake command in radians */ @return speedbrake command in radians */
inline float GetDsbCmd(void) { return DsbCmd; } inline double GetDsbCmd(void) { return DsbCmd; }
/** Gets the spoiler command. /** Gets the spoiler command.
@return spoiler command in radians */ @return spoiler command in radians */
inline float GetDspCmd(void) { return DspCmd; } inline double GetDspCmd(void) { return DspCmd; }
/** Gets the throttle command. /** Gets the throttle command.
@param engine engine ID number @param engine engine ID number
@return throttle command in percent ( 0 - 100) for the given engine */ @return throttle command in percent ( 0 - 100) for the given engine */
float GetThrottleCmd(int engine); double GetThrottleCmd(int engine);
/** Gets the mixture command. /** Gets the mixture command.
@param engine engine ID number @param engine engine ID number
@return mixture command in percent ( 0 - 100) for the given engine */ @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. /** Gets the pitch trim command.
@return pitch trim command in radians */ @return pitch trim command in radians */
inline float GetPitchTrimCmd(void) { return PTrimCmd; } inline double GetPitchTrimCmd(void) { return PTrimCmd; }
//@} //@}
/// @name Aerosurface position retrieval /// @name Aerosurface position retrieval
//@{ //@{
/** Gets the aileron position. /** Gets the aileron position.
@return aileron position in radians */ @return aileron position in radians */
inline float GetDaPos(void) { return DaPos; } inline double GetDaPos(void) { return DaPos; }
/** Gets the elevator position. /** Gets the elevator position.
@return elevator position in radians */ @return elevator position in radians */
inline float GetDePos(void) { return DePos; } inline double GetDePos(void) { return DePos; }
/** Gets the rudder position. /** Gets the rudder position.
@return rudder position in radians */ @return rudder position in radians */
inline float GetDrPos(void) { return DrPos; } inline double GetDrPos(void) { return DrPos; }
/** Gets the flaps position. /** Gets the flaps position.
@return flaps position in radians */ @return flaps position in radians */
inline float GetDfPos(void) { return DfPos; } inline double GetDfPos(void) { return DfPos; }
/** Gets the speedbrake position. /** Gets the speedbrake position.
@return speedbrake position in radians */ @return speedbrake position in radians */
inline float GetDsbPos(void) { return DsbPos; } inline double GetDsbPos(void) { return DsbPos; }
/** Gets the spoiler position. /** Gets the spoiler position.
@return spoiler position in radians */ @return spoiler position in radians */
inline float GetDspPos(void) { return DspPos; } inline double GetDspPos(void) { return DspPos; }
/** Gets the throttle position. /** Gets the throttle position.
@param engine engine ID number @param engine engine ID number
@return throttle position for the given engine in percent ( 0 - 100)*/ @return throttle position for the given engine in percent ( 0 - 100)*/
float GetThrottlePos(int engine); double GetThrottlePos(int engine);
/** Gets the mixture position. /** Gets the mixture position.
@param engine engine ID number @param engine engine ID number
@return mixture position for the given engine in percent ( 0 - 100)*/ @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. /** Retrieves the State object pointer.
@ -253,7 +253,7 @@ public:
/** Retrieves a components output value /** Retrieves a components output value
@param idx the index of the component (the component ID) @param idx the index of the component (the component ID)
@return output value from the component */ @return output value from the component */
float GetComponentOutput(eParam idx); double GetComponentOutput(eParam idx);
/** Retrieves the component name /** Retrieves the component name
@param idx the index of the component (the component ID) @param idx the index of the component (the component ID)
@ -270,98 +270,98 @@ public:
//@{ //@{
/** Sets the aileron command /** Sets the aileron command
@param cmd aileron command in radians*/ @param cmd aileron command in radians*/
inline void SetDaCmd(float cmd) { DaCmd = cmd; } inline void SetDaCmd(double cmd) { DaCmd = cmd; }
/** Sets the elevator command /** Sets the elevator command
@param cmd elevator command in radians*/ @param cmd elevator command in radians*/
inline void SetDeCmd(float cmd) { DeCmd = cmd; } inline void SetDeCmd(double cmd) { DeCmd = cmd; }
/** Sets the rudder command /** Sets the rudder command
@param cmd rudder command in radians*/ @param cmd rudder command in radians*/
inline void SetDrCmd(float cmd) { DrCmd = cmd; } inline void SetDrCmd(double cmd) { DrCmd = cmd; }
/** Sets the flaps command /** Sets the flaps command
@param cmd flaps command in radians*/ @param cmd flaps command in radians*/
inline void SetDfCmd(float cmd) { DfCmd = cmd; } inline void SetDfCmd(double cmd) { DfCmd = cmd; }
/** Sets the speedbrake command /** Sets the speedbrake command
@param cmd speedbrake command in radians*/ @param cmd speedbrake command in radians*/
inline void SetDsbCmd(float cmd) { DsbCmd = cmd; } inline void SetDsbCmd(double cmd) { DsbCmd = cmd; }
/** Sets the spoilers command /** Sets the spoilers command
@param cmd spoilers command in radians*/ @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 /** Sets the pitch trim command
@param cmd pitch trim command in radians*/ @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 /** Sets the throttle command for the specified engine
@param engine engine ID number @param engine engine ID number
@param cmd throttle command in percent (0 - 100)*/ @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 /** Sets the mixture command for the specified engine
@param engine engine ID number @param engine engine ID number
@param cmd mixture command in percent (0 - 100)*/ @param cmd mixture command in percent (0 - 100)*/
void SetMixtureCmd(int engine, float cmd); void SetMixtureCmd(int engine, double cmd);
//@} //@}
/// @name Aerosurface position setting /// @name Aerosurface position setting
//@{ //@{
/** Sets the aileron position /** Sets the aileron position
@param cmd aileron position in radians*/ @param cmd aileron position in radians*/
inline void SetDaPos(float cmd) { DaPos = cmd; } inline void SetDaPos(double cmd) { DaPos = cmd; }
/** Sets the elevator position /** Sets the elevator position
@param cmd elevator position in radians*/ @param cmd elevator position in radians*/
inline void SetDePos(float cmd) { DePos = cmd; } inline void SetDePos(double cmd) { DePos = cmd; }
/** Sets the rudder position /** Sets the rudder position
@param cmd rudder position in radians*/ @param cmd rudder position in radians*/
inline void SetDrPos(float cmd) { DrPos = cmd; } inline void SetDrPos(double cmd) { DrPos = cmd; }
/** Sets the flaps position /** Sets the flaps position
@param cmd flaps position in radians*/ @param cmd flaps position in radians*/
inline void SetDfPos(float cmd) { DfPos = cmd; } inline void SetDfPos(double cmd) { DfPos = cmd; }
/** Sets the speedbrake position /** Sets the speedbrake position
@param cmd speedbrake position in radians*/ @param cmd speedbrake position in radians*/
inline void SetDsbPos(float cmd) { DsbPos = cmd; } inline void SetDsbPos(double cmd) { DsbPos = cmd; }
/** Sets the spoiler position /** Sets the spoiler position
@param cmd spoiler position in radians*/ @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 /** Sets the actual throttle setting for the specified engine
@param engine engine ID number @param engine engine ID number
@param cmd throttle setting in percent (0 - 100)*/ @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 /** Sets the actual mixture setting for the specified engine
@param engine engine ID number @param engine engine ID number
@param cmd mixture setting in percent (0 - 100)*/ @param cmd mixture setting in percent (0 - 100)*/
void SetMixturePos(int engine, float cmd); void SetMixturePos(int engine, double cmd);
//@} //@}
/// @name Landing Gear brakes /// @name Landing Gear brakes
//@{ //@{
/** Sets the left brake group /** Sets the left brake group
@param cmd brake setting in percent (0.0 - 1.0) */ @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 /** Sets the right brake group
@param cmd brake setting in percent (0.0 - 1.0) */ @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 /** Sets the center brake group
@param cmd brake setting in percent (0.0 - 1.0) */ @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. /** Gets the brake for a specified group.
@param bg which brakegroup to retrieve the command for @param bg which brakegroup to retrieve the command for
@return the brake setting for the supplied brake group argument */ @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. /** Loads the Flight Control System.
@ -375,14 +375,14 @@ public:
void AddThrottle(void); void AddThrottle(void);
private: private:
float DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd; double DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
float DaPos, DePos, DrPos, DfPos, DsbPos, DspPos; double DaPos, DePos, DrPos, DfPos, DsbPos, DspPos;
float PTrimCmd; double PTrimCmd;
vector <float> ThrottleCmd; vector <double> ThrottleCmd;
vector <float> ThrottlePos; vector <double> ThrottlePos;
vector <float> MixtureCmd; vector <double> MixtureCmd;
vector <float> MixturePos; vector <double> MixturePos;
float LeftBrake, RightBrake, CenterBrake; // Brake settings double LeftBrake, RightBrake, CenterBrake; // Brake settings
vector <FGFCSComponent*> Components; vector <FGFCSComponent*> Components;
void Debug(void); void Debug(void);

View file

@ -320,6 +320,7 @@ int FGFDMExec::Schedule(FGModel* model, int rate)
model_iterator->NextModel->SetRate(rate); model_iterator->NextModel->SetRate(rate);
} }
return 0; return 0;
} }
@ -413,7 +414,7 @@ bool FGFDMExec::LoadScript(string script)
string aircraft=""; string aircraft="";
string initialize=""; string initialize="";
bool result=false; bool result=false;
float dt=0.0; double dt=0.0;
int i; int i;
struct condition *newCondition; struct condition *newCondition;
@ -424,13 +425,13 @@ bool FGFDMExec::LoadScript(string script)
Scripted = true; Scripted = true;
if (debug_lvl > 0) cout << "Reading Script File " << ScriptName << endl; 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(); token = Script.GetValue();
if (token == "use") { if (token == "use") {
if ((token = Script.GetValue("aircraft")) != "") { if ((token = Script.GetValue("aircraft")) != string("")) {
aircraft = token; aircraft = token;
if (debug_lvl > 0) cout << " Use aircraft: " << token << endl; if (debug_lvl > 0) cout << " Use aircraft: " << token << endl;
} else if ((token = Script.GetValue("initialize")) != "") { } else if ((token = Script.GetValue("initialize")) != string("")) {
initialize = token; initialize = token;
if (debug_lvl > 0) cout << " Use reset file: " << token << endl; if (debug_lvl > 0) cout << " Use reset file: " << token << endl;
} else { } else {
@ -444,13 +445,13 @@ bool FGFDMExec::LoadScript(string script)
State->Setdt(dt); State->Setdt(dt);
Script.GetNextConfigLine(); Script.GetNextConfigLine();
token = Script.GetValue(); token = Script.GetValue();
while (token != "/run") { while (token != string("/run")) {
if (token == "when") { if (token == "when") {
Script.GetNextConfigLine(); Script.GetNextConfigLine();
token = Script.GetValue(); token = Script.GetValue();
newCondition = new struct condition(); newCondition = new struct condition();
while (token != "/when") { while (token != string("/when")) {
if (token == "parameter") { if (token == "parameter") {
newCondition->TestParam.push_back(State->GetParameterIndex(Script.GetValue("name"))); newCondition->TestParam.push_back(State->GetParameterIndex(Script.GetValue("name")));
newCondition->TestValue.push_back(strtod(Script.GetValue("value").c_str(), NULL)); newCondition->TestValue.push_back(strtod(Script.GetValue("value").c_str(), NULL));
@ -599,8 +600,8 @@ void FGFDMExec::RunScript(void)
int count=0; int count=0;
float currentTime = State->Getsim_time(); double currentTime = State->Getsim_time();
float newSetValue; double newSetValue;
while (iC < Conditions.end()) { while (iC < Conditions.end()) {
// determine whether the set of conditional tests for this condition equate // determine whether the set of conditional tests for this condition equate
@ -668,6 +669,9 @@ void FGFDMExec::RunScript(void)
break; break;
} }
State->SetParameter(iC->SetParam[i], newSetValue); 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++; iC++;

View file

@ -294,18 +294,18 @@ private:
struct condition { struct condition {
vector <eParam> TestParam; vector <eParam> TestParam;
vector <eParam> SetParam; vector <eParam> SetParam;
vector <float> TestValue; vector <double> TestValue;
vector <float> SetValue; vector <double> SetValue;
vector <string> Comparison; vector <string> Comparison;
vector <float> TC; vector <double> TC;
vector <bool> Persistent; vector <bool> Persistent;
vector <eAction> Action; vector <eAction> Action;
vector <eType> Type; vector <eType> Type;
vector <bool> Triggered; vector <bool> Triggered;
vector <float> newValue; vector <double> newValue;
vector <float> OriginalValue; vector <double> OriginalValue;
vector <float> StartTime; vector <double> StartTime;
vector <float> EndTime; vector <double> EndTime;
condition() { condition() {
} }
@ -326,8 +326,8 @@ private:
string EnginePath; string EnginePath;
string ScriptPath; string ScriptPath;
string ScriptName; string ScriptName;
float StartTime; double StartTime;
float EndTime; double EndTime;
vector <struct condition> Conditions; vector <struct condition> Conditions;
FGState* State; FGState* State;

View file

@ -99,7 +99,7 @@ bool FGFactorGroup::Load(FGConfigFile *AC_cfg) {
//if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers()); //if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers());
} }
token = AC_cfg->GetValue(); token = AC_cfg->GetValue();
while ( token != "/GROUP" ) { while ( token != string("/GROUP") ) {
sum.push_back( new FGCoefficient(FDMExec) ); sum.push_back( new FGCoefficient(FDMExec) );
sum.back()->Load(AC_cfg); sum.back()->Load(AC_cfg);
//if (debug_lvl > 0) DisplayCoeffFactors(ca.back()->Getmultipliers()); //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; int i;
float totalsum=0; double totalsum=0;
SDtotal=0.0; SDtotal=0.0;
for(i=0;i<sum.size();i++) { for(i=0;i<sum.size();i++) {
totalsum+=sum[i]->TotalValue(); totalsum+=sum[i]->TotalValue();

View file

@ -98,11 +98,11 @@ class FGFactorGroup: public FGCoefficient {
~FGFactorGroup(); ~FGFactorGroup();
bool Load(FGConfigFile *AC_cfg); bool Load(FGConfigFile *AC_cfg);
float TotalValue(void); double TotalValue(void);
//string GetCoefficientStrings(void); //string GetCoefficientStrings(void);
//string GetCoefficientValues(void); //string GetCoefficientValues(void);
inline float GetSD(void) { return SDtotal; } inline double GetSD(void) { return SDtotal; }
inline float GetFactorSD(void) { return FGCoefficient::GetSD(); } inline double GetFactorSD(void) { return FGCoefficient::GetSD(); }
private: private:
FGFDMExec *FDMExec; FGFDMExec *FDMExec;
@ -110,7 +110,7 @@ class FGFactorGroup: public FGCoefficient {
string description; string description;
typedef vector<FGCoefficient*> CoeffArray; typedef vector<FGCoefficient*> CoeffArray;
CoeffArray sum; CoeffArray sum;
float SDtotal; double SDtotal;
void Debug(void); void Debug(void);
}; };

View file

@ -102,7 +102,7 @@ FGColumnVector3& FGForce::GetBodyForces(void) {
FGMatrix33 FGForce::Transform(void) { FGMatrix33 FGForce::Transform(void) {
switch(ttype) { switch(ttype) {
case tWindBody: case tWindBody:
return fdmex->GetState()->GetTs2b(fdmex->GetTranslation()->Getalpha(),fdmex->GetTranslation()->Getbeta()); return fdmex->GetState()->GetTs2b();
case tLocalBody: case tLocalBody:
return fdmex->GetState()->GetTl2b(); return fdmex->GetState()->GetTl2b();
case tCustom: 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) { if(ttype == tCustom) {
float cp,sp,cr,sr,cy,sy; double cp,sp,cr,sr,cy,sy;
cp=cos(bpitch); sp=sin(bpitch); cp=cos(bpitch); sp=sin(bpitch);
cr=cos(broll); sr=sin(broll); cr=cos(broll); sr=sin(broll);

View file

@ -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 <p>Note that storing the native forces and moments outside of this class is not
strictly necessary, overloaded SetNativeForces() and SetNativeMoments() methods 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 repeatedly called without incurring undue overhead. The body axes force vector
can now be retrieved by calling:</p> can now be retrieved by calling:</p>
@ -227,14 +227,14 @@ public:
enum TransformType { tNone, tWindBody, tLocalBody, tCustom } ttype; 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(1)=Fnx;
vFn(2)=Fny; vFn(2)=Fny;
vFn(3)=Fnz; vFn(3)=Fnz;
} }
inline void SetNativeForces(FGColumnVector3 vv) { vFn = vv; }; 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(1)=Ln;
vMn(2)=Mn; vMn(2)=Mn;
vMn(3)=Nn; vMn(3)=Nn;
@ -251,14 +251,14 @@ public:
//point of application, JSBsim structural coords //point of application, JSBsim structural coords
//(inches, x +back, y +right, z +up) //(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(1) = x;
vXYZn(2) = y; vXYZn(2) = y;
vXYZn(3) = z; vXYZn(3) = z;
} }
inline void SetLocationX(float x) {vXYZn(1) = x;} inline void SetLocationX(double x) {vXYZn(1) = x;}
inline void SetLocationY(float y) {vXYZn(2) = y;} inline void SetLocationY(double y) {vXYZn(2) = y;}
inline void SetLocationZ(float z) {vXYZn(3) = z;} inline void SetLocationZ(double z) {vXYZn(3) = z;}
inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; } inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; }
FGColumnVector3& GetLocation(void) { return vXYZn; } FGColumnVector3& GetLocation(void) { return vXYZn; }
@ -269,10 +269,10 @@ public:
//are going to get confused. //are going to get confused.
//They are in radians. //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 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 void SetSense(FGColumnVector3 vv) { vSense=vv; }
inline FGColumnVector3& GetSense(void) { return vSense; } inline FGColumnVector3& GetSense(void) { return vSense; }

View file

@ -61,8 +61,8 @@ FGGroundReactions::FGGroundReactions(FGFDMExec* fgex) : FGModel(fgex),
bool FGGroundReactions::Run(void) bool FGGroundReactions::Run(void)
{ {
float steerAngle = 0.0; double steerAngle = 0.0;
float xForces = 0.0, yForces = 0.0; double xForces = 0.0, yForces = 0.0;
if (!FGModel::Run()) { if (!FGModel::Run()) {
vForces.InitMatrix(); vForces.InitMatrix();
@ -147,7 +147,7 @@ bool FGGroundReactions::Load(FGConfigFile* AC_cfg)
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/UNDERCARRIAGE") { while ((token = AC_cfg->GetValue()) != string("/UNDERCARRIAGE")) {
lGear.push_back(FGLGear(AC_cfg, FDMExec)); lGear.push_back(FGLGear(AC_cfg, FDMExec));
} }

View file

@ -78,7 +78,7 @@ FGInertial::~FGInertial(void)
bool FGInertial::Run(void) bool FGInertial::Run(void)
{ {
float stht, ctht, sphi, cphi; double stht, ctht, sphi, cphi;
if (!FGModel::Run()) { if (!FGModel::Run()) {

View file

@ -75,7 +75,7 @@ public:
bool Run(void); bool Run(void);
FGColumnVector3& GetForces(void) {return vForces;} FGColumnVector3& GetForces(void) {return vForces;}
FGColumnVector3& GetGravity(void) {return vGravity;} FGColumnVector3& GetGravity(void) {return vGravity;}
float GetForces(int n) {return vForces(n);} double GetForces(int n) {return vForces(n);}
bool LoadInertial(FGConfigFile* AC_cfg); bool LoadInertial(FGConfigFile* AC_cfg);
double SLgravity(void) {return gAccelReference;} double SLgravity(void) {return gAccelReference;}
double gravity(void) {return gAccel;} double gravity(void) {return gAccel;}

View file

@ -103,7 +103,7 @@ FGInitialCondition::~FGInitialCondition()
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetVcalibratedKtsIC(float tt) { void FGInitialCondition::SetVcalibratedKtsIC(double tt) {
if(getMachFromVcas(&mach,tt*ktstofps)) { if(getMachFromVcas(&mach,tt*ktstofps)) {
//cout << "Mach: " << mach << endl; //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; ve=tt*ktstofps;
lastSpeedSet=setve; lastSpeedSet=setve;
vt=ve*1/sqrt(fdmex->GetAtmosphere()->GetDensityRatio()); vt=ve*1/sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
@ -131,9 +131,9 @@ void FGInitialCondition::SetVequivalentKtsIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetVgroundFpsIC(float tt) { void FGInitialCondition::SetVgroundFpsIC(double tt) {
float ua,va,wa; double ua,va,wa;
float vxz; double vxz;
vg=tt; vg=tt;
lastSpeedSet=setvg; lastSpeedSet=setvg;
@ -152,7 +152,7 @@ void FGInitialCondition::SetVgroundFpsIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetVtrueFpsIC(float tt) { void FGInitialCondition::SetVtrueFpsIC(double tt) {
vt=tt; vt=tt;
lastSpeedSet=setvt; lastSpeedSet=setvt;
mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed(); 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; mach=tt;
lastSpeedSet=setmach; lastSpeedSet=setmach;
vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed(); 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); SetClimbRateFpsIC(tt/60.0);
} }
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetClimbRateFpsIC(float tt) { void FGInitialCondition::SetClimbRateFpsIC(double tt) {
if(vt > 0.1) { if(vt > 0.1) {
hdot=tt; hdot=tt;
@ -190,7 +190,7 @@ void FGInitialCondition::SetClimbRateFpsIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetFlightPathAngleRadIC(float tt) { void FGInitialCondition::SetFlightPathAngleRadIC(double tt) {
gamma=tt; gamma=tt;
sgamma=sin(gamma); cgamma=cos(gamma); sgamma=sin(gamma); cgamma=cos(gamma);
getTheta(); getTheta();
@ -199,7 +199,7 @@ void FGInitialCondition::SetFlightPathAngleRadIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetAlphaRadIC(float tt) { void FGInitialCondition::SetAlphaRadIC(double tt) {
alpha=tt; alpha=tt;
salpha=sin(alpha); calpha=cos(alpha); salpha=sin(alpha); calpha=cos(alpha);
getTheta(); getTheta();
@ -207,7 +207,7 @@ void FGInitialCondition::SetAlphaRadIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetPitchAngleRadIC(float tt) { void FGInitialCondition::SetPitchAngleRadIC(double tt) {
theta=tt; theta=tt;
stheta=sin(theta); ctheta=cos(theta); stheta=sin(theta); ctheta=cos(theta);
getAlpha(); getAlpha();
@ -215,7 +215,7 @@ void FGInitialCondition::SetPitchAngleRadIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetBetaRadIC(float tt) { void FGInitialCondition::SetBetaRadIC(double tt) {
beta=tt; beta=tt;
sbeta=sin(beta); cbeta=cos(beta); sbeta=sin(beta); cbeta=cos(beta);
getTheta(); getTheta();
@ -224,7 +224,7 @@ void FGInitialCondition::SetBetaRadIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetRollAngleRadIC(float tt) { void FGInitialCondition::SetRollAngleRadIC(double tt) {
phi=tt; phi=tt;
sphi=sin(phi); cphi=cos(phi); sphi=sin(phi); cphi=cos(phi);
getTheta(); getTheta();
@ -232,7 +232,7 @@ void FGInitialCondition::SetRollAngleRadIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetTrueHeadingRadIC(float tt) { void FGInitialCondition::SetTrueHeadingRadIC(double tt) {
psi=tt; psi=tt;
spsi=sin(psi); cpsi=cos(psi); spsi=sin(psi); cpsi=cos(psi);
calcWindUVW(); calcWindUVW();
@ -240,7 +240,7 @@ void FGInitialCondition::SetTrueHeadingRadIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetUBodyFpsIC(float tt) { void FGInitialCondition::SetUBodyFpsIC(double tt) {
u=tt; u=tt;
vt=sqrt(u*u + v*v + w*w); vt=sqrt(u*u + v*v + w*w);
lastSpeedSet=setuvw; lastSpeedSet=setuvw;
@ -248,7 +248,7 @@ void FGInitialCondition::SetUBodyFpsIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetVBodyFpsIC(float tt) { void FGInitialCondition::SetVBodyFpsIC(double tt) {
v=tt; v=tt;
vt=sqrt(u*u + v*v + w*w); vt=sqrt(u*u + v*v + w*w);
lastSpeedSet=setuvw; lastSpeedSet=setuvw;
@ -256,7 +256,7 @@ void FGInitialCondition::SetVBodyFpsIC(float tt) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetWBodyFpsIC(float tt) { void FGInitialCondition::SetWBodyFpsIC(double tt) {
w=tt; w=tt;
vt=sqrt( u*u + v*v + w*w ); vt=sqrt( u*u + v*v + w*w );
lastSpeedSet=setuvw; lastSpeedSet=setuvw;
@ -264,7 +264,7 @@ void FGInitialCondition::SetWBodyFpsIC(float tt) {
//****************************************************************************** //******************************************************************************
float FGInitialCondition::GetUBodyFpsIC(void) { double FGInitialCondition::GetUBodyFpsIC(void) {
if(lastSpeedSet == setvg ) if(lastSpeedSet == setvg )
return u; return u;
else else
@ -273,7 +273,7 @@ float FGInitialCondition::GetUBodyFpsIC(void) {
//****************************************************************************** //******************************************************************************
float FGInitialCondition::GetVBodyFpsIC(void) { double FGInitialCondition::GetVBodyFpsIC(void) {
if( lastSpeedSet == setvg ) if( lastSpeedSet == setvg )
return v; return v;
else { else {
@ -283,7 +283,7 @@ float FGInitialCondition::GetVBodyFpsIC(void) {
//****************************************************************************** //******************************************************************************
float FGInitialCondition::GetWBodyFpsIC(void) { double FGInitialCondition::GetWBodyFpsIC(void) {
if( lastSpeedSet == setvg ) if( lastSpeedSet == setvg )
return w; return w;
else 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; wnorth = wN; weast = wE; wdown = wD;
lastWindSet = setwned; lastWindSet = setwned;
calcWindUVW(); calcWindUVW();
@ -303,7 +303,7 @@ void FGInitialCondition::SetWindNEDFpsIC(float wN, float wE, float wD ) {
//****************************************************************************** //******************************************************************************
// positive from left // positive from left
void FGInitialCondition::SetHeadWindKtsIC(float head){ void FGInitialCondition::SetHeadWindKtsIC(double head){
whead=head*ktstofps; whead=head*ktstofps;
lastWindSet=setwhc; lastWindSet=setwhc;
calcWindUVW(); calcWindUVW();
@ -314,7 +314,7 @@ void FGInitialCondition::SetHeadWindKtsIC(float head){
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetCrossWindKtsIC(float cross){ void FGInitialCondition::SetCrossWindKtsIC(double cross){
wcross=cross*ktstofps; wcross=cross*ktstofps;
lastWindSet=setwhc; lastWindSet=setwhc;
calcWindUVW(); calcWindUVW();
@ -325,7 +325,7 @@ void FGInitialCondition::SetCrossWindKtsIC(float cross){
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetWindDownKtsIC(float wD) { void FGInitialCondition::SetWindDownKtsIC(double wD) {
wdown=wD; wdown=wD;
calcWindUVW(); calcWindUVW();
if(lastSpeedSet == setvg) 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; wmag=mag*ktstofps;
lastWindSet=setwmd; lastWindSet=setwmd;
calcWindUVW(); calcWindUVW();
@ -344,7 +344,7 @@ void FGInitialCondition::SetWindMagKtsIC(float mag) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetWindDirDegIC(float dir) { void FGInitialCondition::SetWindDirDegIC(double dir) {
wdir=dir*degtorad; wdir=dir*degtorad;
lastWindSet=setwmd; lastWindSet=setwmd;
calcWindUVW(); calcWindUVW();
@ -389,7 +389,7 @@ void FGInitialCondition::calcWindUVW(void) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetAltitudeFtIC(float tt) { void FGInitialCondition::SetAltitudeFtIC(double tt) {
altitude=tt; altitude=tt;
fdmex->GetPosition()->Seth(altitude); fdmex->GetPosition()->Seth(altitude);
fdmex->GetAtmosphere()->Run(); 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); fdmex->GetPosition()->SetDistanceAGL(tt);
altitude=fdmex->GetPosition()->Geth(); altitude=fdmex->GetPosition()->Geth();
SetAltitudeFtIC(altitude); SetAltitudeFtIC(altitude);
@ -452,7 +452,7 @@ void FGInitialCondition::calcUVWfromNED(void) {
//****************************************************************************** //******************************************************************************
void FGInitialCondition::SetVnorthFpsIC(float tt) { void FGInitialCondition::SetVnorthFpsIC(double tt) {
vnorth=tt; vnorth=tt;
calcUVWfromNED(); calcUVWfromNED();
vt=sqrt(u*u + v*v + w*w); 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; veast=tt;
calcUVWfromNED(); calcUVWfromNED();
vt=sqrt(u*u + v*v + w*w); 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; vdown=tt;
calcUVWfromNED(); calcUVWfromNED();
vt=sqrt(u*u + v*v + w*w); 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; bool result=false;
float guess=1.5; double guess=1.5;
xlo=xhi=0; xlo=xhi=0;
xmin=0;xmax=50; xmin=0;xmax=50;
sfunc=&FGInitialCondition::calcVcas; sfunc=&FGInitialCondition::calcVcas;
@ -498,7 +498,7 @@ bool FGInitialCondition::getMachFromVcas(float *Mach,float vcas) {
bool FGInitialCondition::getAlpha(void) { bool FGInitialCondition::getAlpha(void) {
bool result=false; bool result=false;
float guess=theta-gamma; double guess=theta-gamma;
xlo=xhi=0; xlo=xhi=0;
xmin=fdmex->GetAircraft()->GetAlphaCLMin(); xmin=fdmex->GetAircraft()->GetAlphaCLMin();
xmax=fdmex->GetAircraft()->GetAlphaCLMax(); xmax=fdmex->GetAircraft()->GetAlphaCLMax();
@ -518,7 +518,7 @@ bool FGInitialCondition::getAlpha(void) {
bool FGInitialCondition::getTheta(void) { bool FGInitialCondition::getTheta(void) {
bool result=false; bool result=false;
float guess=alpha+gamma; double guess=alpha+gamma;
xlo=xhi=0; xlo=xhi=0;
xmin=-89;xmax=89; xmin=-89;xmax=89;
sfunc=&FGInitialCondition::GammaEqOfTheta; sfunc=&FGInitialCondition::GammaEqOfTheta;
@ -535,9 +535,9 @@ bool FGInitialCondition::getTheta(void) {
//****************************************************************************** //******************************************************************************
float FGInitialCondition::GammaEqOfTheta(float Theta) { double FGInitialCondition::GammaEqOfTheta(double Theta) {
float a,b,c,d; double a,b,c,d;
float sTheta,cTheta; double sTheta,cTheta;
//theta=Theta; stheta=sin(theta); ctheta=cos(theta); //theta=Theta; stheta=sin(theta); ctheta=cos(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) { double FGInitialCondition::GammaEqOfAlpha(double Alpha) {
float a,b,c,d; double a,b,c,d;
float sAlpha,cAlpha; double sAlpha,cAlpha;
sAlpha=sin(Alpha); cAlpha=cos(Alpha); sAlpha=sin(Alpha); cAlpha=cos(Alpha);
a=wdown + vt*cAlpha*cbeta + uw; 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(); double p=fdmex->GetAtmosphere()->GetPressure();
float psl=fdmex->GetAtmosphere()->GetPressureSL(); double psl=fdmex->GetAtmosphere()->GetPressureSL();
float rhosl=fdmex->GetAtmosphere()->GetDensitySL(); double rhosl=fdmex->GetAtmosphere()->GetDensitySL();
float pt,A,B,D,vcas; double pt,A,B,D,vcas;
if(Mach < 0) Mach=0; if(Mach < 0) Mach=0;
if(Mach < 1) //calculate total pressure assuming isentropic flow if(Mach < 1) //calculate total pressure assuming isentropic flow
pt=p*pow((1 + 0.2*Mach*Mach),3.5); 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) { bool FGInitialCondition::findInterval(double x,double guess) {
//void find_interval(inter_params &ip,eqfunc f,float y,float constant, int &flag){ //void find_interval(inter_params &ip,eqfunc f,double y,double constant, int &flag){
int i=0; int i=0;
bool found=false; bool found=false;
float flo,fhi,fguess; double flo,fhi,fguess;
float lo,hi,step; double lo,hi,step;
step=0.1; step=0.1;
fguess=(this->*sfunc)(guess)-x; fguess=(this->*sfunc)(guess)-x;
lo=hi=guess; 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; double x1,x2,x3,f1,f2,f3,d,d0;
float eps=1E-5; double eps=1E-5;
float const relax =0.9; double const relax =0.9;
int i; int i;
bool success=false; 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) if(weast != 0.0)
return atan2(weast,wnorth)*radtodeg; return atan2(weast,wnorth)*radtodeg;
else if(wnorth > 0) 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 resetDef;
string token=""; string token="";
float temp; double temp;
# ifndef macintosh # ifndef macintosh
resetDef = path + "/" + acname + "/" + fname + ".xml"; resetDef = acpath + "/" + acname + "/" + rstfile + ".xml";
# else # else
resetDef = path + ";" + acname + ";" + fname + ".xml"; resetDef = acpath + ";" + acname + ";" + rstfile + ".xml";
# endif # endif
cout << resetDef << endl;
FGConfigFile resetfile(resetDef); FGConfigFile resetfile(resetDef);
if (!resetfile.IsOpen()) return false; if (!resetfile.IsOpen()) return false;
resetfile.GetNextConfigLine(); resetfile.GetNextConfigLine();
token = resetfile.GetValue(); token = resetfile.GetValue();
if (token != "initialize") { if (token != string("initialize")) {
cerr << "The reset file " << resetDef cerr << "The reset file " << resetDef
<< " does not appear to be a reset file" << endl; << " does not appear to be a reset file" << endl;
return false; return false;
@ -733,7 +732,7 @@ bool FGInitialCondition::Load(string path, string acname, string fname)
resetfile.GetNextConfigLine(); resetfile.GetNextConfigLine();
resetfile >> token; resetfile >> token;
while (token != "/initialize" && token != "EOF") { while (token != string("/initialize") && token != string("EOF")) {
if (token == "UBODY" ) { resetfile >> temp; SetUBodyFpsIC(temp); } if (token == "UBODY" ) { resetfile >> temp; SetUBodyFpsIC(temp); }
if (token == "VBODY" ) { resetfile >> temp; SetVBodyFpsIC(temp); } if (token == "VBODY" ) { resetfile >> temp; SetVBodyFpsIC(temp); }
if (token == "WBODY" ) { resetfile >> temp; SetWBodyFpsIC(temp); } if (token == "WBODY" ) { resetfile >> temp; SetWBodyFpsIC(temp); }

View file

@ -140,137 +140,137 @@ public:
/// Destructor /// Destructor
~FGInitialCondition(); ~FGInitialCondition();
void SetVcalibratedKtsIC(float tt); void SetVcalibratedKtsIC(double tt);
void SetVequivalentKtsIC(float tt); void SetVequivalentKtsIC(double tt);
inline void SetVtrueKtsIC(float tt) { SetVtrueFpsIC(tt*ktstofps); } inline void SetVtrueKtsIC(double tt) { SetVtrueFpsIC(tt*ktstofps); }
inline void SetVgroundKtsIC(float tt) { SetVgroundFpsIC(tt*ktstofps); } inline void SetVgroundKtsIC(double tt) { SetVgroundFpsIC(tt*ktstofps); }
void SetMachIC(float tt); void SetMachIC(double tt);
inline void SetAlphaDegIC(float tt) { SetAlphaRadIC(tt*degtorad); } inline void SetAlphaDegIC(double tt) { SetAlphaRadIC(tt*degtorad); }
inline void SetBetaDegIC(float tt) { SetBetaRadIC(tt*degtorad);} inline void SetBetaDegIC(double tt) { SetBetaRadIC(tt*degtorad);}
inline void SetPitchAngleDegIC(float tt) { SetPitchAngleRadIC(tt*degtorad); } inline void SetPitchAngleDegIC(double tt) { SetPitchAngleRadIC(tt*degtorad); }
inline void SetRollAngleDegIC(float tt) { SetRollAngleRadIC(tt*degtorad);} inline void SetRollAngleDegIC(double tt) { SetRollAngleRadIC(tt*degtorad);}
inline void SetTrueHeadingDegIC(float tt){ SetTrueHeadingRadIC(tt*degtorad); } inline void SetTrueHeadingDegIC(double tt){ SetTrueHeadingRadIC(tt*degtorad); }
void SetClimbRateFpmIC(float tt); void SetClimbRateFpmIC(double tt);
inline void SetFlightPathAngleDegIC(float tt) { SetFlightPathAngleRadIC(tt*degtorad); } inline void SetFlightPathAngleDegIC(double tt) { SetFlightPathAngleRadIC(tt*degtorad); }
void SetAltitudeFtIC(float tt); void SetAltitudeFtIC(double tt);
void SetAltitudeAGLFtIC(float tt); void SetAltitudeAGLFtIC(double tt);
void SetSeaLevelRadiusFtIC(double tt); void SetSeaLevelRadiusFtIC(double tt);
void SetTerrainAltitudeFtIC(double tt); void SetTerrainAltitudeFtIC(double tt);
inline void SetLatitudeDegIC(float tt) { latitude=tt*degtorad; } inline void SetLatitudeDegIC(double tt) { latitude=tt*degtorad; }
inline void SetLongitudeDegIC(float tt) { longitude=tt*degtorad; } inline void SetLongitudeDegIC(double tt) { longitude=tt*degtorad; }
inline float GetVcalibratedKtsIC(void) { return vc*fpstokts; } inline double GetVcalibratedKtsIC(void) { return vc*fpstokts; }
inline float GetVequivalentKtsIC(void) { return ve*fpstokts; } inline double GetVequivalentKtsIC(void) { return ve*fpstokts; }
inline float GetVgroundKtsIC(void) { return vg*fpstokts; } inline double GetVgroundKtsIC(void) { return vg*fpstokts; }
inline float GetVtrueKtsIC(void) { return vt*fpstokts; } inline double GetVtrueKtsIC(void) { return vt*fpstokts; }
inline float GetMachIC(void) { return mach; } inline double GetMachIC(void) { return mach; }
inline float GetClimbRateFpmIC(void) { return hdot*60; } inline double GetClimbRateFpmIC(void) { return hdot*60; }
inline float GetFlightPathAngleDegIC(void) { return gamma*radtodeg; } inline double GetFlightPathAngleDegIC(void) { return gamma*radtodeg; }
inline float GetAlphaDegIC(void) { return alpha*radtodeg; } inline double GetAlphaDegIC(void) { return alpha*radtodeg; }
inline float GetBetaDegIC(void) { return beta*radtodeg; } inline double GetBetaDegIC(void) { return beta*radtodeg; }
inline float GetPitchAngleDegIC(void) { return theta*radtodeg; } inline double GetPitchAngleDegIC(void) { return theta*radtodeg; }
inline float GetRollAngleDegIC(void) { return phi*radtodeg; } inline double GetRollAngleDegIC(void) { return phi*radtodeg; }
inline float GetHeadingDegIC(void) { return psi*radtodeg; } inline double GetHeadingDegIC(void) { return psi*radtodeg; }
inline float GetLatitudeDegIC(void) { return latitude*radtodeg; } inline double GetLatitudeDegIC(void) { return latitude*radtodeg; }
inline float GetLongitudeDegIC(void) { return longitude*radtodeg; } inline double GetLongitudeDegIC(void) { return longitude*radtodeg; }
inline float GetAltitudeFtIC(void) { return altitude; } inline double GetAltitudeFtIC(void) { return altitude; }
inline float GetAltitudeAGLFtIC(void) { return altitude - terrain_altitude; } inline double GetAltitudeAGLFtIC(void) { return altitude - terrain_altitude; }
inline float GetSeaLevelRadiusFtIC(void) { return sea_level_radius; } inline double GetSeaLevelRadiusFtIC(void) { return sea_level_radius; }
inline float GetTerrainAltitudeFtIC(void) { return terrain_altitude; } inline double GetTerrainAltitudeFtIC(void) { return terrain_altitude; }
void SetVgroundFpsIC(float tt); void SetVgroundFpsIC(double tt);
void SetVtrueFpsIC(float tt); void SetVtrueFpsIC(double tt);
void SetUBodyFpsIC(float tt); void SetUBodyFpsIC(double tt);
void SetVBodyFpsIC(float tt); void SetVBodyFpsIC(double tt);
void SetWBodyFpsIC(float tt); void SetWBodyFpsIC(double tt);
void SetVnorthFpsIC(float tt); void SetVnorthFpsIC(double tt);
void SetVeastFpsIC(float tt); void SetVeastFpsIC(double tt);
void SetVdownFpsIC(float 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 SetWindMagKtsIC(double mag);
void SetWindDirDegIC(float dir); void SetWindDirDegIC(double dir);
void SetHeadWindKtsIC(float head); void SetHeadWindKtsIC(double head);
void SetCrossWindKtsIC(float cross);// positive from left void SetCrossWindKtsIC(double cross);// positive from left
void SetWindDownKtsIC(float wD); void SetWindDownKtsIC(double wD);
void SetClimbRateFpsIC(float tt); void SetClimbRateFpsIC(double tt);
inline float GetVgroundFpsIC(void) { return vg; } inline double GetVgroundFpsIC(void) { return vg; }
inline float GetVtrueFpsIC(void) { return vt; } inline double GetVtrueFpsIC(void) { return vt; }
inline float GetWindUFpsIC(void) { return uw; } inline double GetWindUFpsIC(void) { return uw; }
inline float GetWindVFpsIC(void) { return vw; } inline double GetWindVFpsIC(void) { return vw; }
inline float GetWindWFpsIC(void) { return ww; } inline double GetWindWFpsIC(void) { return ww; }
inline float GetWindNFpsIC(void) { return wnorth; } inline double GetWindNFpsIC(void) { return wnorth; }
inline float GetWindEFpsIC(void) { return weast; } inline double GetWindEFpsIC(void) { return weast; }
inline float GetWindDFpsIC(void) { return wdown; } inline double GetWindDFpsIC(void) { return wdown; }
inline float GetWindFpsIC(void) { return sqrt(wnorth*wnorth + weast*weast); } inline double GetWindFpsIC(void) { return sqrt(wnorth*wnorth + weast*weast); }
float GetWindDirDegIC(void); double GetWindDirDegIC(void);
inline float GetClimbRateFpsIC(void) { return hdot; } inline double GetClimbRateFpsIC(void) { return hdot; }
float GetUBodyFpsIC(void); double GetUBodyFpsIC(void);
float GetVBodyFpsIC(void); double GetVBodyFpsIC(void);
float GetWBodyFpsIC(void); double GetWBodyFpsIC(void);
void SetFlightPathAngleRadIC(float tt); void SetFlightPathAngleRadIC(double tt);
void SetAlphaRadIC(float tt); void SetAlphaRadIC(double tt);
void SetPitchAngleRadIC(float tt); void SetPitchAngleRadIC(double tt);
void SetBetaRadIC(float tt); void SetBetaRadIC(double tt);
void SetRollAngleRadIC(float tt); void SetRollAngleRadIC(double tt);
void SetTrueHeadingRadIC(float tt); void SetTrueHeadingRadIC(double tt);
inline void SetLatitudeRadIC(float tt) { latitude=tt; } inline void SetLatitudeRadIC(double tt) { latitude=tt; }
inline void SetLongitudeRadIC(float tt) { longitude=tt; } inline void SetLongitudeRadIC(double tt) { longitude=tt; }
inline float GetFlightPathAngleRadIC(void) { return gamma; } inline double GetFlightPathAngleRadIC(void) { return gamma; }
inline float GetAlphaRadIC(void) { return alpha; } inline double GetAlphaRadIC(void) { return alpha; }
inline float GetPitchAngleRadIC(void) { return theta; } inline double GetPitchAngleRadIC(void) { return theta; }
inline float GetBetaRadIC(void) { return beta; } inline double GetBetaRadIC(void) { return beta; }
inline float GetRollAngleRadIC(void) { return phi; } inline double GetRollAngleRadIC(void) { return phi; }
inline float GetHeadingRadIC(void) { return psi; } inline double GetHeadingRadIC(void) { return psi; }
inline float GetLatitudeRadIC(void) { return latitude; } inline double GetLatitudeRadIC(void) { return latitude; }
inline float GetLongitudeRadIC(void) { return longitude; } inline double GetLongitudeRadIC(void) { return longitude; }
inline float GetThetaRadIC(void) { return theta; } inline double GetThetaRadIC(void) { return theta; }
inline float GetPhiRadIC(void) { return phi; } inline double GetPhiRadIC(void) { return phi; }
inline float GetPsiRadIC(void) { return psi; } inline double GetPsiRadIC(void) { return psi; }
inline speedset GetSpeedSet(void) { return lastSpeedSet; } inline speedset GetSpeedSet(void) { return lastSpeedSet; }
inline windset GetWindSet(void) { return lastWindSet; } inline windset GetWindSet(void) { return lastWindSet; }
bool Load(string path, string acname, string fname); bool Load(string acpath, string acname, string rstname);
private: private:
float vt,vc,ve,vg; double vt,vc,ve,vg;
float mach; double mach;
float altitude,hdot; double altitude,hdot;
float latitude,longitude; double latitude,longitude;
float u,v,w; double u,v,w;
float uw,vw,ww; double uw,vw,ww;
float vnorth,veast,vdown; double vnorth,veast,vdown;
float wnorth,weast,wdown; double wnorth,weast,wdown;
float whead, wcross, wdir, wmag; double whead, wcross, wdir, wmag;
double sea_level_radius; double sea_level_radius;
double terrain_altitude; double terrain_altitude;
double radius_to_vehicle; double radius_to_vehicle;
float alpha, beta, theta, phi, psi, gamma; double alpha, beta, theta, phi, psi, gamma;
float salpha,sbeta,stheta,sphi,spsi,sgamma; double salpha,sbeta,stheta,sphi,spsi,sgamma;
float calpha,cbeta,ctheta,cphi,cpsi,cgamma; 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; fp sfunc;
speedset lastSpeedSet; speedset lastSpeedSet;
@ -280,16 +280,16 @@ private:
bool getAlpha(void); bool getAlpha(void);
bool getTheta(void); bool getTheta(void);
bool getMachFromVcas(float *Mach,float vcas); bool getMachFromVcas(double *Mach,double vcas);
float GammaEqOfTheta(float Theta); double GammaEqOfTheta(double Theta);
float GammaEqOfAlpha(float Alpha); double GammaEqOfAlpha(double Alpha);
float calcVcas(float Mach); double calcVcas(double Mach);
void calcUVWfromNED(void); void calcUVWfromNED(void);
void calcWindUVW(void); void calcWindUVW(void);
bool findInterval(float x,float guess); bool findInterval(double x,double guess);
bool solve(float *y, float x); bool solve(double *y, double x);
}; };
#endif #endif

View file

@ -43,17 +43,22 @@ INCLUDES
# include <math.h> # include <math.h>
# include <queue> # include <queue>
# include STL_STRING # include STL_STRING
SG_USING_STD(queue);
SG_USING_STD(string);
SG_USING_STD(queue);
#else #else
# include <queue>
# include <string>
# if defined(sgi) && !defined(__GNUC__) # if defined(sgi) && !defined(__GNUC__)
# include <math.h> # include <math.h>
# include <queue.h>
# include <string.h>
# else # else
# include <cmath> # include <cmath>
# include <queue>
# include <string>
# endif # endif
using std::string;
using std::queue;
#endif #endif
#ifndef M_PI #ifndef M_PI

View file

@ -112,7 +112,7 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : vXYZ(3),
FCS = Exec->GetFCS(); FCS = Exec->GetFCS();
MassBalance = Exec->GetMassBalance(); MassBalance = Exec->GetMassBalance();
WOW = false; WOW = lastWOW = false;
ReportEnable = true; ReportEnable = true;
FirstContact = false; FirstContact = false;
Reported = false; Reported = false;
@ -147,6 +147,7 @@ FGLGear::FGLGear(const FGLGear& lgear)
vLocalGear = lgear.vLocalGear; vLocalGear = lgear.vLocalGear;
WOW = lgear.WOW; WOW = lgear.WOW;
lastWOW = lgear.lastWOW;
ReportEnable = lgear.ReportEnable; ReportEnable = lgear.ReportEnable;
FirstContact = lgear.FirstContact; FirstContact = lgear.FirstContact;
DistanceTraveled = lgear.DistanceTraveled; DistanceTraveled = lgear.DistanceTraveled;
@ -184,10 +185,10 @@ FGLGear::~FGLGear()
FGColumnVector3& FGLGear::Force(void) FGColumnVector3& FGLGear::Force(void)
{ {
float SteerGain; double SteerGain;
float SinWheel, CosWheel, SideWhlVel, RollingWhlVel; double SinWheel, CosWheel, SideWhlVel, RollingWhlVel;
float RudderPedal, RollingForce, SideForce, FCoeff; double RudderPedal, RollingForce, SideForce, FCoeff;
float WheelSlip; double WheelSlip;
vWhlBodyVec = (vXYZ - MassBalance->GetXYZcg()) / 12.0; vWhlBodyVec = (vXYZ - MassBalance->GetXYZcg()) / 12.0;
vWhlBodyVec(eX) = -vWhlBodyVec(eX); vWhlBodyVec(eX) = -vWhlBodyVec(eX);
@ -337,7 +338,7 @@ FGColumnVector3& FGLGear::Force(void)
// case. NOTE: SQUARE LAW DAMPING NO GOOD! // case. NOTE: SQUARE LAW DAMPING NO GOOD!
vLocalForce(eZ) = min(-compressLength * kSpring vLocalForce(eZ) = min(-compressLength * kSpring
- compressSpeed * bDamp, (float)0.0); - compressSpeed * bDamp, (double)0.0);
MaximumStrutForce = max(MaximumStrutForce, fabs(vLocalForce(eZ))); MaximumStrutForce = max(MaximumStrutForce, fabs(vLocalForce(eZ)));
MaximumStrutTravel = max(MaximumStrutTravel, fabs(compressLength)); MaximumStrutTravel = max(MaximumStrutTravel, fabs(compressLength));
@ -397,6 +398,23 @@ FGColumnVector3& FGLGear::Force(void)
if (debug_lvl > 0) Report(); 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; return vForce;
} }

View file

@ -200,22 +200,22 @@ public:
/// Gets the location of the gear in Body axes /// Gets the location of the gear in Body axes
FGColumnVector3& GetBodyLocation(void) { return vWhlBodyVec; } FGColumnVector3& GetBodyLocation(void) { return vWhlBodyVec; }
float GetBodyLocation(int idx) { return vWhlBodyVec(idx); } double GetBodyLocation(int idx) { return vWhlBodyVec(idx); }
FGColumnVector3& GetLocalGear(void) { return vLocalGear; } 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 /// Gets the name of the gear
inline string GetName(void) {return name; } inline string GetName(void) {return name; }
/// Gets the Weight On Wheels flag value /// Gets the Weight On Wheels flag value
inline bool GetWOW(void) {return WOW; } inline bool GetWOW(void) {return WOW; }
/// Gets the current compressed length of the gear in feet /// 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 /// 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 /// Gets the gear compression force in pounds
inline float GetCompForce(void) {return Force()(3); } inline double GetCompForce(void) {return Force()(3); }
inline float GetBrakeFCoeff(void) {return BrakeFCoeff;} inline double GetBrakeFCoeff(void) {return BrakeFCoeff;}
/// Sets the brake value in percent (0 - 100) /// Sets the brake value in percent (0 - 100)
inline void SetBrake(double bp) {brakePct = bp;} inline void SetBrake(double bp) {brakePct = bp;}
@ -226,8 +226,8 @@ public:
/** Get the console touchdown reporting feature /** Get the console touchdown reporting feature
@return true if reporting is turned on */ @return true if reporting is turned on */
inline bool GetReport(void) { return ReportEnable; } inline bool GetReport(void) { return ReportEnable; }
inline float GetSteerAngle(void) { return SteerAngle;} inline double GetSteerAngle(void) { return SteerAngle;}
inline float GetstaticFCoeff(void) { return staticFCoeff;} inline double GetstaticFCoeff(void) { return staticFCoeff;}
inline int GetBrakeGroup(void) { return (int)eBrakeGrp; } inline int GetBrakeGroup(void) { return (int)eBrakeGrp; }
inline int GetSteerType(void) { return (int)eSteerType; } inline int GetSteerType(void) { return (int)eSteerType; }
@ -240,21 +240,22 @@ private:
FGColumnVector3 vForce; FGColumnVector3 vForce;
FGColumnVector3 vLocalForce; FGColumnVector3 vLocalForce;
FGColumnVector3 vWhlVelVec; // Velocity of this wheel (Local) FGColumnVector3 vWhlVelVec; // Velocity of this wheel (Local)
float SteerAngle; double SteerAngle;
float kSpring; double kSpring;
float bDamp; double bDamp;
float compressLength; double compressLength;
float compressSpeed; double compressSpeed;
float staticFCoeff, dynamicFCoeff, rollingFCoeff; double staticFCoeff, dynamicFCoeff, rollingFCoeff;
float brakePct; double brakePct;
float BrakeFCoeff; double BrakeFCoeff;
float maxCompLen; double maxCompLen;
double SinkRate; double SinkRate;
double GroundSpeed; double GroundSpeed;
double DistanceTraveled; double DistanceTraveled;
double MaximumStrutForce; double MaximumStrutForce;
double MaximumStrutTravel; double MaximumStrutTravel;
bool WOW; bool WOW;
bool lastWOW;
bool FirstContact; bool FirstContact;
bool Reported; bool Reported;
bool ReportEnable; bool ReportEnable;
@ -263,7 +264,7 @@ private:
string sBrakeGroup; string sBrakeGroup;
BrakeGroup eBrakeGrp; BrakeGroup eBrakeGrp;
SteerType eSteerType; SteerType eSteerType;
float maxSteerAngle; double maxSteerAngle;
FGFDMExec* Exec; FGFDMExec* Exec;
FGState* State; FGState* State;

View file

@ -60,38 +60,38 @@ public:
bool Run(void); bool Run(void);
inline float GetMass(void) {return Mass;} inline double GetMass(void) {return Mass;}
inline float GetWeight(void) {return Weight;} inline double GetWeight(void) {return Weight;}
inline float GetIxx(void) {return Ixx;} inline double GetIxx(void) {return Ixx;}
inline float GetIyy(void) {return Iyy;} inline double GetIyy(void) {return Iyy;}
inline float GetIzz(void) {return Izz;} inline double GetIzz(void) {return Izz;}
inline float GetIxz(void) {return Ixz;} inline double GetIxz(void) {return Ixz;}
inline float GetIyz(void) {return Iyz;} inline double GetIyz(void) {return Iyz;}
inline FGColumnVector3& GetXYZcg(void) {return vXYZcg;} 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 SetEmptyWeight(double EW) { EmptyWeight = EW;}
inline void SetBaseIxx(float bixx) { baseIxx = bixx;} inline void SetBaseIxx(double bixx) { baseIxx = bixx;}
inline void SetBaseIyy(float biyy) { baseIyy = biyy;} inline void SetBaseIyy(double biyy) { baseIyy = biyy;}
inline void SetBaseIzz(float bizz) { baseIzz = bizz;} inline void SetBaseIzz(double bizz) { baseIzz = bizz;}
inline void SetBaseIxz(float bixz) { baseIxz = bixz;} inline void SetBaseIxz(double bixz) { baseIxz = bixz;}
inline void SetBaseIyz(float biyz) { baseIyz = biyz;} inline void SetBaseIyz(double biyz) { baseIyz = biyz;}
inline void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = CG;} inline void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = CG;}
private: private:
float Weight; double Weight;
float EmptyWeight; double EmptyWeight;
float Mass; double Mass;
float Ixx; double Ixx;
float Iyy; double Iyy;
float Izz; double Izz;
float Ixz; double Ixz;
float Iyz; double Iyz;
float baseIxx; double baseIxx;
float baseIyy; double baseIyy;
float baseIzz; double baseIzz;
float baseIxz; double baseIxz;
float baseIyz; double baseIyz;
FGColumnVector3 vXYZcg; FGColumnVector3 vXYZcg;
FGColumnVector3 vXYZtank; FGColumnVector3 vXYZtank;
FGColumnVector3 vbaseXYZcg; FGColumnVector3 vbaseXYZcg;

View file

@ -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; data[rowCtr][colCtr] = ff;
if (++colCtr > Cols()) { if (++colCtr > Cols()) {
@ -304,7 +304,7 @@ FGMatrix33 FGMatrix33::operator*(const FGMatrix33& M)
void 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]; 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); data[1][1] = a*M(1,1) + b*M(2,1) + c*M(3,1);

View file

@ -111,7 +111,7 @@ public:
FGMatrix33 operator*(const FGMatrix33& B); FGMatrix33 operator*(const FGMatrix33& B);
FGMatrix33 operator*(const double scalar); FGMatrix33 operator*(const double scalar);
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 ostream& operator<<(ostream& os, const FGMatrix33& M);
friend istream& operator>>(istream& is, FGMatrix33& M); friend istream& operator>>(istream& is, FGMatrix33& M);

View file

@ -58,7 +58,7 @@ FGNozzle::FGNozzle(FGFDMExec* FDMExec, FGConfigFile* Nzl_cfg) : FGThruster(FDMEx
Name = Nzl_cfg->GetValue("NAME"); Name = Nzl_cfg->GetValue("NAME");
Nzl_cfg->GetNextConfigLine(); Nzl_cfg->GetNextConfigLine();
while (Nzl_cfg->GetValue() != "/FG_NOZZLE") { while (Nzl_cfg->GetValue() != string("/FG_NOZZLE")) {
*Nzl_cfg >> token; *Nzl_cfg >> token;
if (token == "PE") *Nzl_cfg >> PE; if (token == "PE") *Nzl_cfg >> PE;
else if (token == "EXPR") *Nzl_cfg >> ExpR; 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(); double pAtm = fdmex->GetAtmosphere()->GetPressure();
Thrust = max((float)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff); Thrust = max((double)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff);
vFn(1) = Thrust; vFn(1) = Thrust;
return Thrust; return Thrust;
@ -103,7 +103,7 @@ float FGNozzle::Calculate(float CfPc)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGNozzle::GetPowerRequired(void) double FGNozzle::GetPowerRequired(void)
{ {
return PE; return PE;
} }

View file

@ -73,16 +73,16 @@ public:
/// Destructor /// Destructor
~FGNozzle(); ~FGNozzle();
float Calculate(float CfPc); double Calculate(double CfPc);
float GetPowerRequired(void); double GetPowerRequired(void);
private: private:
float PE; double PE;
float ExpR; double ExpR;
float nzlEff; double nzlEff;
float Diameter; double Diameter;
float AreaT; double AreaT;
float Area2; double Area2;
void Debug(void); void Debug(void);
}; };

View file

@ -120,7 +120,7 @@ void FGOutput::SetType(string type)
Type = otSocket; Type = otSocket;
} else if (type == "TERMINAL") { } else if (type == "TERMINAL") {
Type = otTerminal; Type = otTerminal;
} else if (type != "NONE"){ } else if (type != string("NONE")){
Type = otUnknown; Type = otUnknown;
cerr << "Unknown type of output specified in config file" << endl; cerr << "Unknown type of output specified in config file" << endl;
} }
@ -130,25 +130,23 @@ void FGOutput::SetType(string type)
void FGOutput::DelimitedOutput(string fname) void FGOutput::DelimitedOutput(string fname)
{ {
# if defined(sgi) && !defined(__GNUC__) streambuf* buffer;
ostream_withassign outstream;
# else
_IO_ostream_withassign outstream;
# endif
if (fname == "COUT" || fname == "cout") { if (fname == "COUT" || fname == "cout") {
outstream = cout; buffer = cout.rdbuf();
} else { } else {
datafile.open(fname.c_str()); datafile.open(fname.c_str());
outstream = datafile; buffer = datafile.rdbuf();
} }
ostream outstream(buffer);
if (dFirstPass) { if (dFirstPass) {
outstream << "Time"; outstream << "Time";
if (SubSystems & FGAircraft::ssSimulation) { if (SubSystems & ssSimulation) {
// Nothing here, yet // Nothing here, yet
} }
if (SubSystems & FGAircraft::ssAerosurfaces) { if (SubSystems & ssAerosurfaces) {
outstream << ", "; outstream << ", ";
outstream << "Throttle, "; outstream << "Throttle, ";
outstream << "Mixture, "; outstream << "Mixture, ";
@ -159,11 +157,11 @@ void FGOutput::DelimitedOutput(string fname)
outstream << "Elevator Pos, "; outstream << "Elevator Pos, ";
outstream << "Rudder Pos"; outstream << "Rudder Pos";
} }
if (SubSystems & FGAircraft::ssRates) { if (SubSystems & ssRates) {
outstream << ", "; outstream << ", ";
outstream << "P, Q, R"; outstream << "P, Q, R";
} }
if (SubSystems & FGAircraft::ssVelocities) { if (SubSystems & ssVelocities) {
outstream << ", "; outstream << ", ";
outstream << "QBar, "; outstream << "QBar, ";
outstream << "Vtotal, "; outstream << "Vtotal, ";
@ -171,21 +169,21 @@ void FGOutput::DelimitedOutput(string fname)
outstream << "UAero, VAero, WAero, "; outstream << "UAero, VAero, WAero, ";
outstream << "Vn, Ve, Vd"; outstream << "Vn, Ve, Vd";
} }
if (SubSystems & FGAircraft::ssForces) { if (SubSystems & ssForces) {
outstream << ", "; outstream << ", ";
outstream << "Drag, Side, Lift, "; outstream << "Drag, Side, Lift, ";
outstream << "L/D, "; outstream << "L/D, ";
outstream << "Xforce, Yforce, Zforce"; outstream << "Xforce, Yforce, Zforce";
} }
if (SubSystems & FGAircraft::ssMoments) { if (SubSystems & ssMoments) {
outstream << ", "; outstream << ", ";
outstream << "L, M, N"; outstream << "L, M, N";
} }
if (SubSystems & FGAircraft::ssAtmosphere) { if (SubSystems & ssAtmosphere) {
outstream << ", "; outstream << ", ";
outstream << "Rho"; outstream << "Rho";
} }
if (SubSystems & FGAircraft::ssMassProps) { if (SubSystems & ssMassProps) {
outstream << ", "; outstream << ", ";
outstream << "Ixx, "; outstream << "Ixx, ";
outstream << "Iyy, "; outstream << "Iyy, ";
@ -194,7 +192,7 @@ void FGOutput::DelimitedOutput(string fname)
outstream << "Mass, "; outstream << "Mass, ";
outstream << "Xcg, Ycg, Zcg"; outstream << "Xcg, Ycg, Zcg";
} }
if (SubSystems & FGAircraft::ssPosition) { if (SubSystems & ssPosition) {
outstream << ", "; outstream << ", ";
outstream << "Altitude, "; outstream << "Altitude, ";
outstream << "Phi, Tht, Psi, "; outstream << "Phi, Tht, Psi, ";
@ -204,15 +202,15 @@ void FGOutput::DelimitedOutput(string fname)
outstream << "Distance AGL, "; outstream << "Distance AGL, ";
outstream << "Runway Radius"; outstream << "Runway Radius";
} }
if (SubSystems & FGAircraft::ssCoefficients) { if (SubSystems & ssCoefficients) {
outstream << ", "; outstream << ", ";
outstream << Aerodynamics->GetCoefficientStrings(); outstream << Aerodynamics->GetCoefficientStrings();
} }
if (SubSystems & FGAircraft::ssGroundReactions) { if (SubSystems & ssGroundReactions) {
outstream << ", "; outstream << ", ";
outstream << GroundReactions->GetGroundReactionStrings(); outstream << GroundReactions->GetGroundReactionStrings();
} }
if (SubSystems & FGAircraft::ssPropulsion) { if (SubSystems & ssPropulsion) {
outstream << ", "; outstream << ", ";
outstream << Propulsion->GetPropulsionStrings(); outstream << Propulsion->GetPropulsionStrings();
} }
@ -222,9 +220,9 @@ void FGOutput::DelimitedOutput(string fname)
} }
outstream << State->Getsim_time(); outstream << State->Getsim_time();
if (SubSystems & FGAircraft::ssSimulation) { if (SubSystems & ssSimulation) {
} }
if (SubSystems & FGAircraft::ssAerosurfaces) { if (SubSystems & ssAerosurfaces) {
outstream << ", "; outstream << ", ";
outstream << FCS->GetThrottlePos(0) << ", "; outstream << FCS->GetThrottlePos(0) << ", ";
outstream << FCS->GetMixturePos(0) << ", "; outstream << FCS->GetMixturePos(0) << ", ";
@ -235,11 +233,11 @@ void FGOutput::DelimitedOutput(string fname)
outstream << FCS->GetDePos() << ", "; outstream << FCS->GetDePos() << ", ";
outstream << FCS->GetDrPos(); outstream << FCS->GetDrPos();
} }
if (SubSystems & FGAircraft::ssRates) { if (SubSystems & ssRates) {
outstream << ", "; outstream << ", ";
outstream << Rotation->GetPQR(); outstream << Rotation->GetPQR();
} }
if (SubSystems & FGAircraft::ssVelocities) { if (SubSystems & ssVelocities) {
outstream << ", "; outstream << ", ";
outstream << Translation->Getqbar() << ", "; outstream << Translation->Getqbar() << ", ";
outstream << Translation->GetVt() << ", "; outstream << Translation->GetVt() << ", ";
@ -247,21 +245,21 @@ void FGOutput::DelimitedOutput(string fname)
outstream << Translation->GetvAero() << ", "; outstream << Translation->GetvAero() << ", ";
outstream << Position->GetVel(); outstream << Position->GetVel();
} }
if (SubSystems & FGAircraft::ssForces) { if (SubSystems & ssForces) {
outstream << ", "; outstream << ", ";
outstream << Aerodynamics->GetvFs() << ", "; outstream << Aerodynamics->GetvFs() << ", ";
outstream << Aerodynamics->GetLoD() << ", "; outstream << Aerodynamics->GetLoD() << ", ";
outstream << Aircraft->GetForces(); outstream << Aircraft->GetForces();
} }
if (SubSystems & FGAircraft::ssMoments) { if (SubSystems & ssMoments) {
outstream << ", "; outstream << ", ";
outstream << Aircraft->GetMoments(); outstream << Aircraft->GetMoments();
} }
if (SubSystems & FGAircraft::ssAtmosphere) { if (SubSystems & ssAtmosphere) {
outstream << ", "; outstream << ", ";
outstream << Atmosphere->GetDensity(); outstream << Atmosphere->GetDensity();
} }
if (SubSystems & FGAircraft::ssMassProps) { if (SubSystems & ssMassProps) {
outstream << ", "; outstream << ", ";
outstream << MassBalance->GetIxx() << ", "; outstream << MassBalance->GetIxx() << ", ";
outstream << MassBalance->GetIyy() << ", "; outstream << MassBalance->GetIyy() << ", ";
@ -270,7 +268,7 @@ void FGOutput::DelimitedOutput(string fname)
outstream << MassBalance->GetMass() << ", "; outstream << MassBalance->GetMass() << ", ";
outstream << MassBalance->GetXYZcg(); outstream << MassBalance->GetXYZcg();
} }
if (SubSystems & FGAircraft::ssPosition) { if (SubSystems & ssPosition) {
outstream << ", "; outstream << ", ";
outstream << Position->Geth() << ", "; outstream << Position->Geth() << ", ";
outstream << Rotation->GetEuler() << ", "; outstream << Rotation->GetEuler() << ", ";
@ -280,15 +278,15 @@ void FGOutput::DelimitedOutput(string fname)
outstream << Position->GetDistanceAGL() << ", "; outstream << Position->GetDistanceAGL() << ", ";
outstream << Position->GetRunwayRadius(); outstream << Position->GetRunwayRadius();
} }
if (SubSystems & FGAircraft::ssCoefficients) { if (SubSystems & ssCoefficients) {
outstream << ", "; outstream << ", ";
outstream << Aerodynamics->GetCoefficientValues(); outstream << Aerodynamics->GetCoefficientValues();
} }
if (SubSystems & FGAircraft::ssGroundReactions) { if (SubSystems & ssGroundReactions) {
outstream << ", "; outstream << ", ";
outstream << GroundReactions->GetGroundReactionValues(); outstream << GroundReactions->GetGroundReactionValues();
} }
if (SubSystems & FGAircraft::ssPropulsion) { if (SubSystems & ssPropulsion) {
outstream << ", "; outstream << ", ";
outstream << Propulsion->GetPropulsionValues(); 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) void FGOutput::Debug(void)
{ {
//TODO: Add your source code here //TODO: Add your source code here

View file

@ -79,6 +79,24 @@ public:
inline void Enable(void) { enabled = true; } inline void Enable(void) { enabled = true; }
inline void Disable(void) { enabled = false; } inline void Disable(void) { enabled = false; }
inline bool Toggle(void) {enabled = !enabled; return enabled;} 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: private:
bool sFirstPass, dFirstPass, enabled; bool sFirstPass, dFirstPass, enabled;

View file

@ -68,7 +68,7 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
Name = Eng_cfg->GetValue("NAME"); Name = Eng_cfg->GetValue("NAME");
Eng_cfg->GetNextConfigLine(); Eng_cfg->GetNextConfigLine();
while (Eng_cfg->GetValue() != "/FG_PISTON") { while (Eng_cfg->GetValue() != string("/FG_PISTON")) {
*Eng_cfg >> token; *Eng_cfg >> token;
if (token == "MINMP") *Eng_cfg >> MinManifoldPressure_inHg; if (token == "MINMP") *Eng_cfg >> MinManifoldPressure_inHg;
else if (token == "MAXMP") *Eng_cfg >> MaxManifoldPressure_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 // FIXME: calculate from actual fuel flow
ConsumeFuel(); ConsumeFuel();
@ -328,10 +328,10 @@ void FGPiston::doManifoldPressure(void)
void FGPiston::doAirFlow(void) void FGPiston::doAirFlow(void)
{ {
rho_air = p_amb / (R_air * T_amb); rho_air = p_amb / (R_air * T_amb);
float rho_air_manifold = rho_air * ManifoldPressure_inHg / 29.6; double rho_air_manifold = rho_air * ManifoldPressure_inHg / 29.6;
float displacement_SI = Displacement * CONVERT_CUBIC_INCHES_TO_METERS_CUBED; double displacement_SI = Displacement * CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
float swept_volume = (displacement_SI * (RPM/60)) / 2; double swept_volume = (displacement_SI * (RPM/60)) / 2;
float v_dot_air = swept_volume * volumetric_efficiency; double v_dot_air = swept_volume * volumetric_efficiency;
m_dot_air = v_dot_air * rho_air_manifold; m_dot_air = v_dot_air * rho_air_manifold;
} }
@ -346,7 +346,7 @@ void FGPiston::doAirFlow(void)
void FGPiston::doFuelFlow(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; equivalence_ratio = thi_sea_level * p_amb_sea_level / p_amb;
m_dot_fuel = m_dot_air / 14.7 * equivalence_ratio; m_dot_fuel = m_dot_air / 14.7 * equivalence_ratio;
} }
@ -368,15 +368,15 @@ void FGPiston::doFuelFlow(void)
void FGPiston::doEnginePower(void) void FGPiston::doEnginePower(void)
{ {
float True_ManifoldPressure_inHg = ManifoldPressure_inHg * p_amb / p_amb_sea_level; double True_ManifoldPressure_inHg = ManifoldPressure_inHg * p_amb / p_amb_sea_level;
float ManXRPM = True_ManifoldPressure_inHg * RPM; double ManXRPM = True_ManifoldPressure_inHg * RPM;
// FIXME: this needs to be generalized // FIXME: this needs to be generalized
Percentage_Power = (6e-9 * ManXRPM * ManXRPM) + (8e-4 * ManXRPM) - 1.0; Percentage_Power = (6e-9 * ManXRPM * ManXRPM) + (8e-4 * ManXRPM) - 1.0;
float T_amb_degF = (T_amb * 1.8) - 459.67; double T_amb_degF = (T_amb * 1.8) - 459.67;
float T_amb_sea_lev_degF = (288 * 1.8) - 459.67; double T_amb_sea_lev_degF = (288 * 1.8) - 459.67;
Percentage_Power = Percentage_Power =
Percentage_Power + ((T_amb_sea_lev_degF - T_amb_degF) * 7 /120); 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); Power_Mixture_Correlation->GetValue(14.7 / equivalence_ratio);
Percentage_Power = Percentage_Power =
Percentage_Power * Percentage_of_best_power_mixture_power / 100.0; Percentage_Power * Percentage_of_best_power_mixture_power / 100.0;
@ -417,10 +417,10 @@ void FGPiston::doEnginePower(void)
void FGPiston::doEGT(void) void FGPiston::doEGT(void)
{ {
combustion_efficiency = Lookup_Combustion_Efficiency->GetValue(equivalence_ratio); 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; combustion_efficiency * 0.33;
float heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel); double heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
float delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust; double delta_T_exhaust = enthalpy_exhaust / heat_capacity_exhaust;
ExhaustGasTemp_degK = T_amb + delta_T_exhaust; ExhaustGasTemp_degK = T_amb + delta_T_exhaust;
ExhaustGasTemp_degK *= 0.444 + ((0.544 - 0.444) * Percentage_Power / 100.0); ExhaustGasTemp_degK *= 0.444 + ((0.544 - 0.444) * Percentage_Power / 100.0);
} }
@ -437,26 +437,26 @@ void FGPiston::doEGT(void)
void FGPiston::doCHT(void) void FGPiston::doCHT(void)
{ {
float h1 = -95.0; double h1 = -95.0;
float h2 = -3.95; double h2 = -3.95;
float h3 = -0.05; double h3 = -0.05;
float arbitary_area = 1.0; double arbitary_area = 1.0;
float CpCylinderHead = 800.0; double CpCylinderHead = 800.0;
float MassCylinderHead = 8.0; double MassCylinderHead = 8.0;
float temperature_difference = CylinderHeadTemp_degK - T_amb; double temperature_difference = CylinderHeadTemp_degK - T_amb;
float v_apparent = IAS * 0.5144444; double v_apparent = IAS * 0.5144444;
float v_dot_cooling_air = arbitary_area * v_apparent; double v_dot_cooling_air = arbitary_area * v_apparent;
float m_dot_cooling_air = v_dot_cooling_air * rho_air; double m_dot_cooling_air = v_dot_cooling_air * rho_air;
float dqdt_from_combustion = double dqdt_from_combustion =
m_dot_fuel * calorific_value_fuel * combustion_efficiency * 0.33; 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); (h3 * RPM * temperature_difference);
float dqdt_free = h1 * temperature_difference; double dqdt_free = h1 * temperature_difference;
float dqdt_cylinder_head = dqdt_from_combustion + dqdt_forced + dqdt_free; 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; CylinderHeadTemp_degK = dqdt_cylinder_head / HeatCapacityCylinderHead;
} }
@ -472,9 +472,9 @@ void FGPiston::doCHT(void)
void FGPiston::doOilTemperature(void) void FGPiston::doOilTemperature(void)
{ {
float idle_percentage_power = 2.3; // approximately double idle_percentage_power = 2.3; // approximately
float target_oil_temp; // Steady state oil temp at the current engine conditions double target_oil_temp; // Steady state oil temp at the current engine conditions
float time_constant; // The time constant for the differential equation double time_constant; // The time constant for the differential equation
if (Running) { if (Running) {
target_oil_temp = 363; target_oil_temp = 363;
@ -488,7 +488,7 @@ void FGPiston::doOilTemperature(void)
// that oil is no longer getting circulated // 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); OilTemp_degK += (dOilTempdt * dt);
} }
@ -504,11 +504,11 @@ void FGPiston::doOilTemperature(void)
void FGPiston::doOilPressure(void) void FGPiston::doOilPressure(void)
{ {
float Oil_Press_Relief_Valve = 60; // FIXME: may vary by engine double Oil_Press_Relief_Valve = 60; // FIXME: may vary by engine
float Oil_Press_RPM_Max = 1800; // FIXME: may vary by engine double Oil_Press_RPM_Max = 1800; // FIXME: may vary by engine
float Design_Oil_Temp = 85; // FIXME: may vary by engine double Design_Oil_Temp = 85; // FIXME: may vary by engine
// FIXME: WRONG!!! (85 degK???) // 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; OilPressure_psi = (Oil_Press_Relief_Valve / Oil_Press_RPM_Max) * RPM;

View file

@ -84,18 +84,18 @@ public:
/// Destructor /// Destructor
~FGPiston(); ~FGPiston();
float Calculate(float PowerRequired); double Calculate(double PowerRequired);
float GetPowerAvailable(void) {return PowerAvailable;} double GetPowerAvailable(void) {return PowerAvailable;}
private: private:
float BrakeHorsePower; double BrakeHorsePower;
float SpeedSlope; double SpeedSlope;
float SpeedIntercept; double SpeedIntercept;
float AltitudeSlope; double AltitudeSlope;
float PowerAvailable; double PowerAvailable;
// timestep // timestep
float dt; double dt;
void doEngineStartup(void); void doEngineStartup(void);
void doManifoldPressure(void); void doManifoldPressure(void);
@ -110,13 +110,13 @@ private:
// //
// constants // constants
// //
const float CONVERT_CUBIC_INCHES_TO_METERS_CUBED; const double CONVERT_CUBIC_INCHES_TO_METERS_CUBED;
const float R_air; const double R_air;
const float rho_fuel; // kg/m^3 const double rho_fuel; // kg/m^3
const float calorific_value_fuel; // W/Kg (approximate) const double calorific_value_fuel; // W/Kg (approximate)
const float Cp_air; // J/KgK const double Cp_air; // J/KgK
const float Cp_fuel; // J/KgK const double Cp_fuel; // J/KgK
FGTable *Lookup_Combustion_Efficiency; FGTable *Lookup_Combustion_Efficiency;
FGTable *Power_Mixture_Correlation; FGTable *Power_Mixture_Correlation;
@ -124,35 +124,35 @@ private:
// //
// Configuration // Configuration
// //
float MinManifoldPressure_inHg; // Inches Hg double MinManifoldPressure_inHg; // Inches Hg
float MaxManifoldPressure_inHg; // Inches Hg double MaxManifoldPressure_inHg; // Inches Hg
float Displacement; // cubic inches double Displacement; // cubic inches
float MaxHP; // horsepower double MaxHP; // horsepower
float Cycles; // cycles/power stroke double Cycles; // cycles/power stroke
float IdleRPM; // revolutions per minute double IdleRPM; // revolutions per minute
// //
// Inputs (in addition to those in FGEngine). // Inputs (in addition to those in FGEngine).
// //
float p_amb; // Pascals double p_amb; // Pascals
float p_amb_sea_level; // Pascals double p_amb_sea_level; // Pascals
float T_amb; // degrees Kelvin double T_amb; // degrees Kelvin
float RPM; // revolutions per minute double RPM; // revolutions per minute
float IAS; // knots double IAS; // knots
// //
// Outputs (in addition to those in FGEngine). // Outputs (in addition to those in FGEngine).
// //
bool Magneto_Left; bool Magneto_Left;
bool Magneto_Right; bool Magneto_Right;
float rho_air; double rho_air;
float volumetric_efficiency; double volumetric_efficiency;
float m_dot_air; double m_dot_air;
float equivalence_ratio; double equivalence_ratio;
float m_dot_fuel; double m_dot_fuel;
float Percentage_Power; double Percentage_Power;
float HP; double HP;
float combustion_efficiency; double combustion_efficiency;
void Debug(void); void Debug(void);
}; };

View file

@ -91,7 +91,7 @@ static const char *IdHdr = ID_POSITION;
CLASS IMPLEMENTATION CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
extern float globalTriNormal[3]; extern double globalTriNormal[3];
extern double globalSceneryAltitude; extern double globalSceneryAltitude;
extern double globalSeaLevelRadius; extern double globalSeaLevelRadius;

View file

@ -104,10 +104,10 @@ public:
inline FGColumnVector3& GetRunwayNormal(void) { return vRunwayNormal; } inline FGColumnVector3& GetRunwayNormal(void) { return vRunwayNormal; }
inline double GetGamma(void) { return gamma; } 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; } inline double GetHOverB(void) { return hoverb; }
void SetvVel(const FGColumnVector3& v) { vVel = v; } 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 SetLongitude(double tt) { Longitude = tt; }
void Seth(double tt); void Seth(double tt);
void SetRunwayRadius(double tt) { RunwayRadius = tt; } void SetRunwayRadius(double tt) { RunwayRadius = tt; }
@ -127,13 +127,13 @@ private:
double LatitudeDot, LongitudeDot, RadiusDot; double LatitudeDot, LongitudeDot, RadiusDot;
double lastLatitudeDot, lastLongitudeDot, lastRadiusDot; double lastLatitudeDot, lastLongitudeDot, lastRadiusDot;
double Longitude, Latitude; double Longitude, Latitude;
float dt; double dt;
double RunwayRadius; double RunwayRadius;
double DistanceAGL; double DistanceAGL;
double SeaLevelRadius; double SeaLevelRadius;
double gamma; double gamma;
double Vt, Vground; double Vt, Vground;
float hoverb,b; double hoverb,b;
double psigt; double psigt;

View file

@ -54,7 +54,7 @@ FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(e
Name = Prop_cfg->GetValue("NAME"); Name = Prop_cfg->GetValue("NAME");
Prop_cfg->GetNextConfigLine(); Prop_cfg->GetNextConfigLine();
while (Prop_cfg->GetValue() != "/FG_PROPELLER") { while (Prop_cfg->GetValue() != string("/FG_PROPELLER")) {
*Prop_cfg >> token; *Prop_cfg >> token;
if (token == "IXX") { if (token == "IXX") {
*Prop_cfg >> 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. // 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; double J, C_Thrust, omega;
float Vel = (fdmex->GetTranslation()->GetvAero())(1); double Vel = (fdmex->GetTranslation()->GetvAero())(1);
float rho = fdmex->GetAtmosphere()->GetDensity(); double rho = fdmex->GetAtmosphere()->GetDensity();
float RPS = RPM/60.0; double RPS = RPM/60.0;
float alpha, beta; double alpha, beta;
if (RPM > 0.10) { if (RPM > 0.10) {
J = Vel / (Diameter * RPM / 60.0); 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'. 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); double J = (fdmex->GetTranslation()->GetvAero())(1) / (Diameter * RPS);
float rho = fdmex->GetAtmosphere()->GetDensity(); double rho = fdmex->GetAtmosphere()->GetDensity();
if (MaxPitch == MinPitch) { // Fixed pitch prop if (MaxPitch == MinPitch) { // Fixed pitch prop
cPReq = cPower->GetValue(J); cPReq = cPower->GetValue(J);

View file

@ -104,7 +104,7 @@ public:
equation for rotational acceleration "a": a = Q/I , where Q is Torque and equation for rotational acceleration "a": a = Q/I , where Q is Torque and
I is moment of inertia for the propeller. I is moment of inertia for the propeller.
@param rpm the rotational velocity of 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 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 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 indices to the power, thrust, and efficiency tables for variable-pitch
propellers. propellers.
@param pitch the pitch of the blade in degrees. */ @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 SetPFactor(double pf) {P_Factor = pf;}
void SetSense(double s) { Sense = s;} void SetSense(double s) { Sense = s;}
/// Retrieves the pitch of the propeller in degrees. /// Retrieves the pitch of the propeller in degrees.
float GetPitch(void) { return Pitch; } double GetPitch(void) { return Pitch; }
/// Retrieves the RPMs of the propeller /// Retrieves the RPMs of the propeller
float GetRPM(void) { return RPM; } double GetRPM(void) { return RPM; }
/// Retrieves the propeller moment of inertia /// 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?) /// 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 - /** Retrieves the power required (or "absorbed") by the propeller -
i.e. the power required to keep spinning the propeller at the current i.e. the power required to keep spinning the propeller at the current
velocity, air density, and rotational rate. */ velocity, air density, and rotational rate. */
float GetPowerRequired(void); double GetPowerRequired(void);
/** Calculates and returns the thrust produced by this propeller. /** Calculates and returns the thrust produced by this propeller.
Given the excess power available from the engine (in foot-pounds), the thrust is 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 accelerate the prop. It could be negative, dictating that the propeller
would be slowed. would be slowed.
@return the thrust in pounds */ @return the thrust in pounds */
float Calculate(float PowerAvailable); double Calculate(double PowerAvailable);
private: private:
int numBlades; int numBlades;
float RPM; double RPM;
float Ixx; double Ixx;
float Diameter; double Diameter;
float MaxPitch; double MaxPitch;
float MinPitch; double MinPitch;
float P_Factor; double P_Factor;
float Sense; double Sense;
float Pitch; double Pitch;
float Torque; double Torque;
FGTable *Efficiency; FGTable *Efficiency;
FGTable *cThrust; FGTable *cThrust;
FGTable *cPower; FGTable *cPower;

View file

@ -87,8 +87,9 @@ FGPropulsion::~FGPropulsion()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGPropulsion::Run(void) { bool FGPropulsion::Run(void)
float PowerAvailable; {
double PowerAvailable;
dt = State->Getdt(); dt = State->Getdt();
Forces->InitMatrix(); Forces->InitMatrix();
@ -102,7 +103,6 @@ bool FGPropulsion::Run(void) {
*Forces += Thrusters[i]->GetBodyForces(); // sum body frame forces *Forces += Thrusters[i]->GetBodyForces(); // sum body frame forces
*Moments += Thrusters[i]->GetMoments(); // sum body frame moments *Moments += Thrusters[i]->GetMoments(); // sum body frame moments
} }
return false; return false;
} else { } else {
return true; return true;
@ -112,8 +112,8 @@ bool FGPropulsion::Run(void) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGPropulsion::GetSteadyState(void) { bool FGPropulsion::GetSteadyState(void) {
float PowerAvailable; double PowerAvailable;
float currentThrust = 0, lastThrust=-1; double currentThrust = 0, lastThrust=-1;
dt = State->Getdt(); dt = State->Getdt();
int steady_count,j=0; int steady_count,j=0;
bool steady=false; bool steady=false;
@ -153,7 +153,7 @@ bool FGPropulsion::GetSteadyState(void) {
bool FGPropulsion::ICEngineStart(void) { bool FGPropulsion::ICEngineStart(void) {
float PowerAvailable; double PowerAvailable;
int j; int j;
dt = State->Getdt(); dt = State->Getdt();
@ -198,7 +198,7 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/PROPULSION") { while ((token = AC_cfg->GetValue()) != string("/PROPULSION")) {
if (token == "AC_ENGINE") { // ============ READING ENGINES if (token == "AC_ENGINE") { // ============ READING ENGINES
@ -230,7 +230,7 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
} }
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/AC_ENGINE") { while ((token = AC_cfg->GetValue()) != string("/AC_ENGINE")) {
*AC_cfg >> token; *AC_cfg >> token;
if (token == "XLOC") { *AC_cfg >> xLoc; } if (token == "XLOC") { *AC_cfg >> xLoc; }
else if (token == "YLOC") { *AC_cfg >> yLoc; } else if (token == "YLOC") { *AC_cfg >> yLoc; }
@ -299,7 +299,7 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
} }
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/AC_THRUSTER") { while ((token = AC_cfg->GetValue()) != string("/AC_THRUSTER")) {
*AC_cfg >> token; *AC_cfg >> token;
if (token == "XLOC") *AC_cfg >> xLoc; if (token == "XLOC") *AC_cfg >> xLoc;
else if (token == "YLOC") *AC_cfg >> yLoc; 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(); iTank = Tanks.begin();
while (iTank < Tanks.end()) { 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(); iTank = Tanks.begin();
while (iTank < Tanks.end()) { while (iTank < Tanks.end()) {
I += ((*iTank)->GetX() - vXYZcg(eX))*((*iTank)->GetX() - vXYZcg(eX)) * (*iTank)->GetContents()/(144.0*Inertial->gravity()); 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(); iTank = Tanks.begin();
while (iTank < Tanks.end()) { while (iTank < Tanks.end()) {
I += ((*iTank)->GetY() - vXYZcg(eY))*((*iTank)->GetY() - vXYZcg(eY)) * (*iTank)->GetContents()/(144.0*Inertial->gravity()); 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(); iTank = Tanks.begin();
while (iTank < Tanks.end()) { while (iTank < Tanks.end()) {
I += ((*iTank)->GetZ() - vXYZcg(eZ))*((*iTank)->GetZ() - vXYZcg(eZ)) * (*iTank)->GetContents()/(144.0*Inertial->gravity()); 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(); iTank = Tanks.begin();
while (iTank < Tanks.end()) { while (iTank < Tanks.end()) {
I += ((*iTank)->GetX() - vXYZcg(eX))*((*iTank)->GetZ() - vXYZcg(eZ)) * (*iTank)->GetContents()/(144.0*Inertial->gravity()); 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(); iTank = Tanks.begin();
while (iTank != Tanks.end()) { while (iTank != Tanks.end()) {
I += ((*iTank)->GetX() - vXYZcg(eX))*((*iTank)->GetY() - vXYZcg(eY)) * (*iTank)->GetContents()/(144.0*Inertial->gravity()); I += ((*iTank)->GetX() - vXYZcg(eX))*((*iTank)->GetY() - vXYZcg(eY)) * (*iTank)->GetContents()/(144.0*Inertial->gravity());

View file

@ -169,18 +169,18 @@ public:
string GetPropulsionValues(void); string GetPropulsionValues(void);
inline FGColumnVector3& GetForces(void) {return *Forces; } 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 FGColumnVector3& GetMoments(void) {return *Moments;}
inline float GetMoments(int n) {return (*Moments)(n);} inline double GetMoments(int n) {return (*Moments)(n);}
FGColumnVector3& GetTanksCG(void); FGColumnVector3& GetTanksCG(void);
float GetTanksWeight(void); double GetTanksWeight(void);
float GetTanksIxx(const FGColumnVector3& vXYZcg); double GetTanksIxx(const FGColumnVector3& vXYZcg);
float GetTanksIyy(const FGColumnVector3& vXYZcg); double GetTanksIyy(const FGColumnVector3& vXYZcg);
float GetTanksIzz(const FGColumnVector3& vXYZcg); double GetTanksIzz(const FGColumnVector3& vXYZcg);
float GetTanksIxz(const FGColumnVector3& vXYZcg); double GetTanksIxz(const FGColumnVector3& vXYZcg);
float GetTanksIxy(const FGColumnVector3& vXYZcg); double GetTanksIxy(const FGColumnVector3& vXYZcg);
private: private:
vector <FGEngine*> Engines; vector <FGEngine*> Engines;
@ -194,7 +194,7 @@ private:
unsigned int numEngines; unsigned int numEngines;
unsigned int numTanks; unsigned int numTanks;
unsigned int numThrusters; unsigned int numThrusters;
float dt; double dt;
FGColumnVector3 *Forces; FGColumnVector3 *Forces;
FGColumnVector3 *Moments; FGColumnVector3 *Moments;
FGColumnVector3 vXYZtank; FGColumnVector3 vXYZtank;

View file

@ -54,7 +54,7 @@ FGRocket::FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg) : FGEngine(exec)
Name = Eng_cfg->GetValue("NAME"); Name = Eng_cfg->GetValue("NAME");
Eng_cfg->GetNextConfigLine(); Eng_cfg->GetNextConfigLine();
while (Eng_cfg->GetValue() != "/FG_ROCKET") { while (Eng_cfg->GetValue() != string("/FG_ROCKET")) {
*Eng_cfg >> token; *Eng_cfg >> token;
if (token == "SHR") *Eng_cfg >> SHR; if (token == "SHR") *Eng_cfg >> SHR;
else if (token == "MAX_PC") *Eng_cfg >> maxPC; 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(); ConsumeFuel();
@ -111,7 +111,7 @@ float FGRocket::Calculate(float pe)
PC = 0.0; PC = 0.0;
} else { } else {
PctPower = Throttle / MaxThrottle; 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))); Cf = sqrt(kFactor*(1 - pow(pe/(PC), (SHR-1)/SHR)));
Flameout = false; Flameout = false;
} }

View file

@ -116,19 +116,19 @@ public:
coefficient times the chamber pressure. coefficient times the chamber pressure.
@param pe nozzle exit pressure @param pe nozzle exit pressure
@return thrust coefficient times chamber pressure */ @return thrust coefficient times chamber pressure */
float Calculate(float pe); double Calculate(double pe);
/** Gets the chamber pressure. /** Gets the chamber pressure.
@return chamber pressure in psf. */ @return chamber pressure in psf. */
float GetChamberPressure(void) {return PC;} double GetChamberPressure(void) {return PC;}
private: private:
float SHR; double SHR;
float maxPC; double maxPC;
float propEff; double propEff;
float kFactor; double kFactor;
float Variance; double Variance;
float PC; double PC;
void Debug(void); void Debug(void);
}; };

View file

@ -101,8 +101,8 @@ FGRotation::~FGRotation()
bool FGRotation::Run(void) bool FGRotation::Run(void)
{ {
float L2, N1; double L2, N1;
float tTheta; double tTheta;
if (!FGModel::Run()) { if (!FGModel::Run()) {
GetState(); GetState();

View file

@ -87,27 +87,27 @@ public:
bool Run(void); bool Run(void);
inline FGColumnVector3& GetPQR(void) {return vPQR;} 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 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 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 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 SetPQR(FGColumnVector3 tt) {vPQR = tt;}
inline void SetEuler(FGColumnVector3 tt) {vEuler = tt;} inline void SetEuler(FGColumnVector3 tt) {vEuler = tt;}
inline float Getphi(void) {return vEuler(1);} inline double Getphi(void) {return vEuler(1);}
inline float Gettht(void) {return vEuler(2);} inline double Gettht(void) {return vEuler(2);}
inline float Getpsi(void) {return vEuler(3);} inline double Getpsi(void) {return vEuler(3);}
inline float GetCosphi(void) {return cPhi;} inline double GetCosphi(void) {return cPhi;}
inline float GetCostht(void) {return cTht;} inline double GetCostht(void) {return cTht;}
inline float GetCospsi(void) {return cPsi;} inline double GetCospsi(void) {return cPsi;}
inline float GetSinphi(void) {return sPhi;} inline double GetSinphi(void) {return sPhi;}
inline float GetSintht(void) {return sTht;} inline double GetSintht(void) {return sTht;}
inline float GetSinpsi(void) {return sPsi;} inline double GetSinpsi(void) {return sPsi;}
private: private:
FGColumnVector3 vPQR; FGColumnVector3 vPQR;
@ -117,12 +117,12 @@ private:
FGColumnVector3 vEulerRates; FGColumnVector3 vEulerRates;
FGColumnVector3 vlastPQRdot; FGColumnVector3 vlastPQRdot;
float cTht,sTht; double cTht,sTht;
float cPhi,sPhi; double cPhi,sPhi;
float cPsi,sPsi; double cPsi,sPsi;
float Ixx, Iyy, Izz, Ixz; double Ixx, Iyy, Izz, Ixz;
float dt; double dt;
void GetState(void); void GetState(void);

View file

@ -59,7 +59,7 @@ FGRotor::~FGRotor()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGRotor::Calculate(float PowerAvailable) double FGRotor::Calculate(double PowerAvailable)
{ {
return 0.0; return 0.0;
} }

View file

@ -56,7 +56,7 @@ public:
FGRotor(FGFDMExec *FDMExec); FGRotor(FGFDMExec *FDMExec);
~FGRotor(); ~FGRotor();
float Calculate(float); double Calculate(double);
private: private:
void Debug(void); void Debug(void);

View file

@ -166,8 +166,8 @@ FGState::~FGState()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGState::GetParameter(eParam val_idx) { double FGState::GetParameter(eParam val_idx) {
float scratch; double scratch;
switch(val_idx) { switch(val_idx) {
case FG_TIME: 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]); 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) { switch(val_idx) {
case FG_ELEVATOR_POS: case FG_ELEVATOR_POS:
FCS->SetDePos(val); FCS->SetDePos(val);
@ -403,10 +403,10 @@ bool FGState::Reset(string path, string acname, string fname)
string resetDef; string resetDef;
string token=""; string token="";
float U, V, W; double U, V, W;
float phi, tht, psi; double phi, tht, psi;
float latitude, longitude, h; double latitude, longitude, h;
float wdir, wmag, wnorth, weast; double wdir, wmag, wnorth, weast;
# ifndef macintosh # ifndef macintosh
resetDef = path + "/" + acname + "/" + fname + ".xml"; 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 !! // Initialize: Assume all angles GIVEN IN RADIANS !!
// //
void FGState::Initialize(float U, float V, float W, void FGState::Initialize(double U, double V, double W,
float phi, float tht, float psi, double phi, double tht, double psi,
float Latitude, float Longitude, float H, double Latitude, double Longitude, double H,
float wnorth, float weast, float wdown) double wnorth, double weast, double wdown)
{ {
float alpha, beta; double alpha, beta;
float qbar, Vt; double qbar, Vt;
FGColumnVector3 vAero; FGColumnVector3 vAero;
Position->SetLatitude(Latitude); Position->SetLatitude(Latitude);
@ -516,10 +516,10 @@ void FGState::Initialize(float U, float V, float W,
void FGState::Initialize(FGInitialCondition *FGIC) { void FGState::Initialize(FGInitialCondition *FGIC) {
float tht,psi,phi; double tht,psi,phi;
float U, V, W, h; double U, V, W, h;
float latitude, longitude; double latitude, longitude;
float wnorth,weast, wdown; double wnorth,weast, wdown;
latitude = FGIC->GetLatitudeRadIC(); latitude = FGIC->GetLatitudeRadIC();
longitude = FGIC->GetLongitudeRadIC(); longitude = FGIC->GetLongitudeRadIC();
@ -567,14 +567,14 @@ bool FGState::StoreData(string fname) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGState::InitMatrices(float phi, float tht, float psi) { void FGState::InitMatrices(double phi, double tht, double psi) {
float thtd2, psid2, phid2; double thtd2, psid2, phid2;
float Sthtd2, Spsid2, Sphid2; double Sthtd2, Spsid2, Sphid2;
float Cthtd2, Cpsid2, Cphid2; double Cthtd2, Cpsid2, Cphid2;
float Cphid2Cthtd2; double Cphid2Cthtd2;
float Cphid2Sthtd2; double Cphid2Sthtd2;
float Sphid2Sthtd2; double Sphid2Sthtd2;
float Sphid2Cthtd2; double Sphid2Cthtd2;
thtd2 = tht/2.0; thtd2 = tht/2.0;
psid2 = psi/2.0; psid2 = psi/2.0;
@ -604,9 +604,9 @@ void FGState::InitMatrices(float phi, float tht, float psi) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGState::CalcMatrices(void) { void FGState::CalcMatrices(void) {
float Q0Q0, Q1Q1, Q2Q2, Q3Q3; double Q0Q0, Q1Q1, Q2Q2, Q3Q3;
float Q0Q1, Q0Q2, Q0Q3, Q1Q2; double Q0Q1, Q0Q2, Q0Q3, Q1Q2;
float Q1Q3, Q2Q3; double Q1Q3, Q2Q3;
Q0Q0 = vQtrn(1)*vQtrn(1); Q0Q0 = vQtrn(1)*vQtrn(1);
Q1Q1 = vQtrn(2)*vQtrn(2); 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); ca = cos(alpha);
sa = sin(alpha); sa = sin(alpha);

View file

@ -147,18 +147,18 @@ public:
@param weast eastward velocity in feet per second @param weast eastward velocity in feet per second
@param wdown downward velocity in feet per second @param wdown downward velocity in feet per second
*/ */
void Initialize(float U, void Initialize(double U,
float V, double V,
float W, double W,
float lat, double lat,
float lon, double lon,
float phi, double phi,
float tht, double tht,
float psi, double psi,
float h, double h,
float wnorth, double wnorth,
float weast, double weast,
float wdown); double wdown);
/** Initializes the simulation state based on parameters from an Initial Conditions object. /** Initializes the simulation state based on parameters from an Initial Conditions object.
@param FGIC pointer to an initial conditions object. @param FGIC pointer to an initial conditions object.
@ -173,12 +173,12 @@ public:
bool StoreData(string filename); bool StoreData(string filename);
/// returns the speed of sound in feet per second. /// 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. /// 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. /// 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. /// Suspends the simulation and sets the delta T to zero.
inline void Suspend(void) {saved_dt = dt; dt = 0.0;} inline void Suspend(void) {saved_dt = dt; dt = 0.0;}
@ -190,7 +190,7 @@ public:
@param val_idx one of the enumerated JSBSim parameters. @param val_idx one of the enumerated JSBSim parameters.
@return the value of the parameter. @return the value of the parameter.
*/ */
float GetParameter(eParam val_idx); double GetParameter(eParam val_idx);
/** Retrieves a parameter. /** Retrieves a parameter.
The parameters that can be retrieved are enumerated in FGJSBBase.h. The parameters that can be retrieved are enumerated in FGJSBBase.h.
@ -198,7 +198,7 @@ public:
i.e. "FG_QBAR". i.e. "FG_QBAR".
@return the value of the parameter. @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. /** Retrieves the JSBSim parameter enumerated item given the text string.
@param val_string the parameter string, i.e. "FG_QBAR". @param val_string the parameter string, i.e. "FG_QBAR".
@ -209,13 +209,13 @@ public:
/** Sets the speed of sound. /** Sets the speed of sound.
@param speed the speed of sound in feet per second. @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. /** Sets the current sim time.
@param cur_time the current time @param cur_time the current time
@return 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; sim_time = cur_time;
return sim_time; return sim_time;
} }
@ -223,18 +223,18 @@ public:
/** Sets the integration time step for the simulation executive. /** Sets the integration time step for the simulation executive.
@param delta_t the time step in seconds. @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. /** Sets the JSBSim parameter to the supplied value.
@param prm the JSBSim parameter to set, i.e. FG_RUDDER_POS. @param prm the JSBSim parameter to set, i.e. FG_RUDDER_POS.
@param val the value to give the parameter. @param val the value to give the parameter.
*/ */
void SetParameter(eParam prm, float val); void SetParameter(eParam prm, double val);
/** Increments the simulation time. /** Increments the simulation time.
@return the new simulation time. @return the new simulation time.
*/ */
inline float IncrTime(void) { inline double IncrTime(void) {
sim_time+=dt; sim_time+=dt;
return sim_time; return sim_time;
} }
@ -244,7 +244,7 @@ public:
@param tht the pitch angle in radians. @param tht the pitch angle in radians.
@param psi the heading 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. /** Calculates the local-to-body and body-to-local conversion matrices.
*/ */
@ -265,11 +265,9 @@ public:
FGColumnVector3& CalcEuler(void); FGColumnVector3& CalcEuler(void);
/** Calculates and returns the stability-to-body axis transformation matrix. /** 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. @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. /** Retrieves the local-to-body transformation matrix.
@return a reference to 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. @param c matrix column index.
@return the matrix element described by the row and column supplied. @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. /** Retrieves the body-to-local transformation matrix.
@return a reference to the body-to-local matrix. @return a reference to the body-to-local matrix.
@ -293,7 +291,7 @@ public:
@param c matrix column index. @param c matrix column index.
@return the matrix element described by the row and column supplied. @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, /** Prints a summary of simulator state (speed, altitude,
configuration, etc.) configuration, etc.)
@ -305,9 +303,9 @@ public:
ParamMap paramdef; ParamMap paramdef;
private: private:
float a; // speed of sound double a; // speed of sound
float sim_time, dt; double sim_time, dt;
float saved_dt; double saved_dt;
FGFDMExec* FDMExec; FGFDMExec* FDMExec;
FGMatrix33 mTb2l; FGMatrix33 mTb2l;

View file

@ -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++) { 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++) { for (int c=0; c<=nCols; c++) {
Data[r][c] = 0.0; 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; int r;
for (r=1; r<=nRows; r++) if (Data[r][0] >= key) break; 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; int r, c;
for (r=1;r<=nRows;r++) if (Data[r][0] >= rowKey) break; 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; *this << (double)n;
return *this; return *this;
} }
*/
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGTable::Print(void) void FGTable::Print(void)

View file

@ -78,8 +78,8 @@ public:
~FGTable(); ~FGTable();
FGTable(int nRows); FGTable(int nRows);
FGTable(int nRows, int nCols); FGTable(int nRows, int nCols);
float GetValue(float key); double GetValue(double key);
float GetValue(float rowKey, float colKey); double GetValue(double rowKey, double colKey);
/** Read the table in. /** Read the table in.
Data in the config file should be in matrix format with the row Data in the config file should be in matrix format with the row
independents as the first column and the column independents in independents as the first column and the column independents in
@ -92,19 +92,19 @@ public:
</pre> </pre>
*/ */
void operator<<(FGConfigFile&); void operator<<(FGConfigFile&);
FGTable& operator<<(const float n);
FGTable& operator<<(const int n);
FGTable& operator<<(const double 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); void Print(void);
private: private:
enum type {tt1D, tt2D} Type; enum type {tt1D, tt2D} Type;
float** Data; double** Data;
int nRows, nCols; int nRows, nCols;
unsigned int colCounter; unsigned int colCounter;
unsigned int rowCounter; unsigned int rowCounter;
float** Allocate(void); double** Allocate(void);
void Debug(void); void Debug(void);
}; };

View file

@ -61,7 +61,7 @@ FGTank::FGTank(FGConfigFile* AC_cfg)
else Type = ttUNKNOWN; else Type = ttUNKNOWN;
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/AC_TANK") { while ((token = AC_cfg->GetValue()) != string("/AC_TANK")) {
if (token == "XLOC") *AC_cfg >> X; if (token == "XLOC") *AC_cfg >> X;
else if (token == "YLOC") *AC_cfg >> Y; else if (token == "YLOC") *AC_cfg >> Y;
else if (token == "ZLOC") *AC_cfg >> Z; 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) { if (used < Contents) {
Contents -= used; Contents -= used;

View file

@ -82,24 +82,24 @@ public:
FGTank(FGConfigFile*); FGTank(FGConfigFile*);
~FGTank(); ~FGTank();
float Reduce(float); double Reduce(double);
int GetType(void) {return Type;} int GetType(void) {return Type;}
bool GetSelected(void) {return Selected;} bool GetSelected(void) {return Selected;}
float GetPctFull(void) {return PctFull;} double GetPctFull(void) {return PctFull;}
float GetContents(void) {return Contents;} double GetContents(void) {return Contents;}
float inline GetX(void) {return X;} double inline GetX(void) {return X;}
float inline GetY(void) {return Y;} double inline GetY(void) {return Y;}
float inline GetZ(void) {return Z;} double inline GetZ(void) {return Z;}
enum TankType {ttUNKNOWN, ttFUEL, ttOXIDIZER}; enum TankType {ttUNKNOWN, ttFUEL, ttOXIDIZER};
private: private:
TankType Type; TankType Type;
float X, Y, Z; double X, Y, Z;
float Capacity; double Capacity;
float Radius; double Radius;
float PctFull; double PctFull;
float Contents; double Contents;
bool Selected; bool Selected;
void Debug(void); void Debug(void);
}; };

View file

@ -74,21 +74,21 @@ public:
enum eType {ttNozzle, ttRotor, ttPropeller}; 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;} void SetName(string name) {Name = name;}
virtual float GetPowerRequired(void) {return 0.0;} virtual double GetPowerRequired(void) {return 0.0;}
virtual void SetdeltaT(float dt) {deltaT = dt;} virtual void SetdeltaT(double dt) {deltaT = dt;}
float GetThrust(void) {return Thrust;} double GetThrust(void) {return Thrust;}
eType GetType(void) {return Type;} eType GetType(void) {return Type;}
string GetName(void) {return Name;} string GetName(void) {return Name;}
virtual float GetRPM(void) { return 0.0; }; virtual double GetRPM(void) { return 0.0; };
protected: protected:
eType Type; eType Type;
string Name; string Name;
float Thrust; double Thrust;
float PowerRequired; double PowerRequired;
float deltaT; double deltaT;
virtual void Debug(void); virtual void Debug(void);
}; };

View file

@ -105,7 +105,7 @@ FGTranslation::~FGTranslation()
bool FGTranslation::Run(void) bool FGTranslation::Run(void)
{ {
float Tc = 0.5*State->Getdt()*rate; double Tc = 0.5*State->Getdt()*rate;
if (!FGModel::Run()) { if (!FGModel::Run()) {
@ -133,8 +133,8 @@ bool FGTranslation::Run(void)
sqrt(vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW))) : 0.0; sqrt(vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW))) : 0.0;
// stolen, quite shamelessly, from LaRCsim // stolen, quite shamelessly, from LaRCsim
float mUW = (vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW)); double mUW = (vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW));
float signU=1; double signU=1;
if (vAero(eU) != 0.0) if (vAero(eU) != 0.0)
signU = vAero(eU)/fabs(vAero(eU)); signU = vAero(eU)/fabs(vAero(eU));

View file

@ -88,31 +88,31 @@ public:
~FGTranslation(); ~FGTranslation();
inline FGColumnVector3& GetUVW (void) { return vUVW; } 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 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 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 double Getalpha(void) { return alpha; }
inline float Getbeta (void) { return beta; } inline double Getbeta (void) { return beta; }
inline float Getqbar (void) { return qbar; } inline double Getqbar (void) { return qbar; }
inline float GetVt (void) { return Vt; } inline double GetVt (void) { return Vt; }
inline float GetMach (void) { return Mach; } inline double GetMach (void) { return Mach; }
inline float Getadot (void) { return adot; } inline double Getadot (void) { return adot; }
inline float Getbdot (void) { return bdot; } inline double Getbdot (void) { return bdot; }
void SetUVW(FGColumnVector3 tt) { vUVW = tt; } void SetUVW(FGColumnVector3 tt) { vUVW = tt; }
inline void Setalpha(float tt) { alpha = tt; } inline void Setalpha(double tt) { alpha = tt; }
inline void Setbeta (float tt) { beta = tt; } inline void Setbeta (double tt) { beta = tt; }
inline void Setqbar (float tt) { qbar = tt; } inline void Setqbar (double tt) { qbar = tt; }
inline void SetVt (float tt) { Vt = tt; } inline void SetVt (double tt) { Vt = tt; }
inline void SetMach (float tt) { Mach=tt; } inline void SetMach (double tt) { Mach=tt; }
inline void Setadot (float tt) { adot = tt; } inline void Setadot (double tt) { adot = tt; }
inline void Setbdot (float tt) { bdot = 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); bool Run(void);
@ -123,10 +123,10 @@ private:
FGMatrix33 mVel; FGMatrix33 mVel;
FGColumnVector3 vAero; FGColumnVector3 vAero;
float Vt, qbar, Mach; double Vt, qbar, Mach;
float dt; double dt;
float alpha, beta; double alpha, beta;
float adot,bdot; double adot,bdot;
void Debug(void); void Debug(void);
}; };

View file

@ -104,8 +104,8 @@ FGTrim::FGTrim(FGFDMExec *FDMExec,FGInitialCondition *FGIC, TrimMode tt ) {
break; break;
} }
//cout << "TrimAxes.size(): " << TrimAxes.size() << endl; //cout << "TrimAxes.size(): " << TrimAxes.size() << endl;
sub_iterations=new float[TrimAxes.size()]; sub_iterations=new double[TrimAxes.size()];
successful=new float[TrimAxes.size()]; successful=new double[TrimAxes.size()];
solution=new bool[TrimAxes.size()]; solution=new bool[TrimAxes.size()];
current_axis=0; 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", snprintf(out,80," %5s: %3.0f average: %5.2f successful: %3.0f stability: %5.2f\n",
TrimAxes[current_axis]->GetStateName().c_str(), TrimAxes[current_axis]->GetStateName().c_str(),
sub_iterations[current_axis], sub_iterations[current_axis],
sub_iterations[current_axis]/float(total_its), sub_iterations[current_axis]/double(total_its),
successful[current_axis], successful[current_axis],
TrimAxes[current_axis]->GetAvgStability() ); TrimAxes[current_axis]->GetAvgStability() );
cout << out; cout << out;
@ -192,8 +192,8 @@ bool FGTrim::AddState( State state, Control control ) {
delete[] sub_iterations; delete[] sub_iterations;
delete[] successful; delete[] successful;
delete[] solution; delete[] solution;
sub_iterations=new float[TrimAxes.size()]; sub_iterations=new double[TrimAxes.size()];
successful=new float[TrimAxes.size()]; successful=new double[TrimAxes.size()];
solution=new bool[TrimAxes.size()]; solution=new bool[TrimAxes.size()];
} }
return result; return result;
@ -221,8 +221,8 @@ bool FGTrim::RemoveState( State state ) {
delete[] sub_iterations; delete[] sub_iterations;
delete[] successful; delete[] successful;
delete[] solution; delete[] solution;
sub_iterations=new float[TrimAxes.size()]; sub_iterations=new double[TrimAxes.size()];
successful=new float[TrimAxes.size()]; successful=new double[TrimAxes.size()];
solution=new bool[TrimAxes.size()]; solution=new bool[TrimAxes.size()];
} }
return result; return result;
@ -365,9 +365,9 @@ bool FGTrim::DoTrim(void) {
bool FGTrim::solve(void) { bool FGTrim::solve(void) {
float x1,x2,x3,f1,f2,f3,d,d0; double x1,x2,x3,f1,f2,f3,d,d0;
const float relax =0.9; const double relax =0.9;
float eps=TrimAxes[current_axis]->GetSolverEps(); double eps=TrimAxes[current_axis]->GetSolverEps();
x1=x2=x3=0; x1=x2=x3=0;
d=1; d=1;
@ -446,12 +446,12 @@ bool FGTrim::solve(void) {
*/ */
bool FGTrim::findInterval(void) { bool FGTrim::findInterval(void) {
bool found=false; bool found=false;
float step; double step;
float current_control=TrimAxes[current_axis]->GetControl(); double current_control=TrimAxes[current_axis]->GetControl();
float current_accel=TrimAxes[current_axis]->GetState();; double current_accel=TrimAxes[current_axis]->GetState();;
float xmin=TrimAxes[current_axis]->GetControlMin(); double xmin=TrimAxes[current_axis]->GetControlMin();
float xmax=TrimAxes[current_axis]->GetControlMax(); double xmax=TrimAxes[current_axis]->GetControlMax();
float lastxlo,lastxhi,lastalo,lastahi; double lastxlo,lastxhi,lastalo,lastahi;
step=0.025*fabs(xmax); step=0.025*fabs(xmax);
xlo=xhi=current_control; xlo=xhi=current_control;
@ -516,8 +516,8 @@ bool FGTrim::findInterval(void) {
bool FGTrim::checkLimits(void) { bool FGTrim::checkLimits(void) {
bool solutionExists; bool solutionExists;
float current_control=TrimAxes[current_axis]->GetControl(); double current_control=TrimAxes[current_axis]->GetControl();
float current_accel=TrimAxes[current_axis]->GetState(); double current_accel=TrimAxes[current_axis]->GetState();
xlo=TrimAxes[current_axis]->GetControlMin(); xlo=TrimAxes[current_axis]->GetControlMin();
xhi=TrimAxes[current_axis]->GetControlMax(); xhi=TrimAxes[current_axis]->GetControlMax();

View file

@ -145,11 +145,11 @@ private:
int N, Nsub; int N, Nsub;
TrimMode mode; TrimMode mode;
int Debug; int Debug;
float Tolerance, A_Tolerance; double Tolerance, A_Tolerance;
float wdot,udot,qdot; double wdot,udot,qdot;
float dth; double dth;
float *sub_iterations; double *sub_iterations;
float *successful; double *successful;
bool *solution; bool *solution;
int max_sub_iterations; int max_sub_iterations;
int max_iterations; int max_iterations;
@ -159,7 +159,7 @@ private:
bool trim_failed; bool trim_failed;
int axis_count; int axis_count;
int solutionDomain; int solutionDomain;
float xlo,xhi,alo,ahi; double xlo,xhi,alo,ahi;
FGFDMExec* fdmex; FGFDMExec* fdmex;
FGInitialCondition* fgic; FGInitialCondition* fgic;
@ -261,7 +261,7 @@ public:
held to a tolerance of 1/10th of the given. The default is 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. 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; Tolerance = tt;
A_Tolerance = tt / 10; A_Tolerance = tt / 10;
} }

View file

@ -186,8 +186,8 @@ void FGTrimAxis::getControl(void) {
/*****************************************************************************/ /*****************************************************************************/
float FGTrimAxis::computeHmgt(void) { double FGTrimAxis::computeHmgt(void) {
float diff; double diff;
diff = fdmex->GetRotation()->Getpsi() - diff = fdmex->GetRotation()->Getpsi() -
fdmex->GetPosition()->GetGroundTrack(); 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 // 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 = // location vector to calculate the new height change. i.e. new altitude =
// earth z component of that vector (which is in body axes ) // 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; int center,i,ref;
// favor an off-center unit so that the same one can be used for both // 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; cout << "SetThetaOnGround ref gear: " << ref << endl;
if(ref >= 0) { if(ref >= 0) {
float sp=fdmex->GetRotation()->GetSinphi(); double sp=fdmex->GetRotation()->GetSinphi();
float cp=fdmex->GetRotation()->GetCosphi(); double cp=fdmex->GetRotation()->GetCosphi();
float lx=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1); double lx=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1);
float ly=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2); double ly=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2);
float lz=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3); double lz=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3);
float hagl = -1*lx*sin(ff) + double hagl = -1*lx*sin(ff) +
ly*sp*cos(ff) + ly*sp*cos(ff) +
lz*cp*cos(ff); lz*cp*cos(ff);
@ -277,9 +277,9 @@ void FGTrimAxis::SetThetaOnGround(float ff) {
bool FGTrimAxis::initTheta(void) { bool FGTrimAxis::initTheta(void) {
int i,N,iAft, iForward; int i,N,iAft, iForward;
float zAft,zForward,zDiff,theta; double zAft,zForward,zDiff,theta;
bool level; bool level;
float saveAlt; double saveAlt;
saveAlt=fgic->GetAltitudeAGLFtIC(); saveAlt=fgic->GetAltitudeAGLFtIC();
fgic->SetAltitudeAGLFtIC(100); fgic->SetAltitudeAGLFtIC(100);
@ -337,7 +337,7 @@ bool FGTrimAxis::initTheta(void) {
/*****************************************************************************/ /*****************************************************************************/
void FGTrimAxis::SetPhiOnGround(float ff) { void FGTrimAxis::SetPhiOnGround(double ff) {
int i,ref; int i,ref;
i=0; ref=-1; i=0; ref=-1;
@ -349,12 +349,12 @@ void FGTrimAxis::SetPhiOnGround(float ff) {
i++; i++;
} }
if(ref >= 0) { if(ref >= 0) {
float st=fdmex->GetRotation()->GetSintht(); double st=fdmex->GetRotation()->GetSintht();
float ct=fdmex->GetRotation()->GetCostht(); double ct=fdmex->GetRotation()->GetCostht();
float lx=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1); double lx=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1);
float ly=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2); double ly=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2);
float lz=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3); double lz=fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3);
float hagl = -1*lx*st + double hagl = -1*lx*st +
ly*sin(ff)*ct + ly*sin(ff)*ct +
lz*cos(ff)*ct; lz*cos(ff)*ct;
@ -368,7 +368,7 @@ void FGTrimAxis::SetPhiOnGround(float ff) {
void FGTrimAxis::Run(void) { void FGTrimAxis::Run(void) {
float last_state_value; double last_state_value;
int i; int i;
setControl(); setControl();
//cout << "FGTrimAxis::Run: " << control_value << endl; //cout << "FGTrimAxis::Run: " << control_value << endl;
@ -393,7 +393,7 @@ void FGTrimAxis::Run(void) {
/*****************************************************************************/ /*****************************************************************************/
void FGTrimAxis::setThrottlesPct(void) { void FGTrimAxis::setThrottlesPct(void) {
float tMin,tMax; double tMin,tMax;
for(unsigned i=0;i<fdmex->GetPropulsion()->GetNumEngines();i++) { for(unsigned i=0;i<fdmex->GetPropulsion()->GetNumEngines();i++) {
tMin=fdmex->GetPropulsion()->GetEngine(i)->GetThrottleMin(); tMin=fdmex->GetPropulsion()->GetEngine(i)->GetThrottleMin();
tMax=fdmex->GetPropulsion()->GetEngine(i)->GetThrottleMax(); 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) { if(total_iterations > 0) {
return float(total_stability_iterations)/float(total_iterations); return double(total_stability_iterations)/double(total_iterations);
} }
return 0; return 0;
} }

View file

@ -82,10 +82,10 @@ public:
void Run(void); void Run(void);
float GetState(void) { getState(); return state_value; } double GetState(void) { getState(); return state_value; }
//Accels are not settable //Accels are not settable
inline void SetControl(float value ) { control_value=value; } inline void SetControl(double value ) { control_value=value; }
inline float GetControl(void) { return control_value; } inline double GetControl(void) { return control_value; }
inline State GetStateType(void) { return state; } inline State GetStateType(void) { return state; }
inline Control GetControlType(void) { return control; } inline Control GetControlType(void) { return control; }
@ -93,32 +93,32 @@ public:
inline string GetStateName(void) { return StateNames[state]; } inline string GetStateName(void) { return StateNames[state]; }
inline string GetControlName(void) { return ControlNames[control]; } inline string GetControlName(void) { return ControlNames[control]; }
inline float GetControlMin(void) { return control_min; } inline double GetControlMin(void) { return control_min; }
inline float GetControlMax(void) { return control_max; } inline double GetControlMax(void) { return control_max; }
inline void SetControlToMin(void) { control_value=control_min; } inline void SetControlToMin(void) { control_value=control_min; }
inline void SetControlToMax(void) { control_value=control_max; } 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_min=min;
control_max=max; control_max=max;
} }
inline void SetTolerance(float ff) { tolerance=ff;} inline void SetTolerance(double ff) { tolerance=ff;}
inline float GetTolerance(void) { return tolerance; } inline double GetTolerance(void) { return tolerance; }
inline float GetSolverEps(void) { return solver_eps; } inline double GetSolverEps(void) { return solver_eps; }
inline void SetSolverEps(float ff) { solver_eps=ff; } inline void SetSolverEps(double ff) { solver_eps=ff; }
inline int GetIterationLimit(void) { return max_iterations; } inline int GetIterationLimit(void) { return max_iterations; }
inline void SetIterationLimit(int ii) { max_iterations=ii; } inline void SetIterationLimit(int ii) { max_iterations=ii; }
inline int GetStability(void) { return its_to_stable_value; } inline int GetStability(void) { return its_to_stable_value; }
inline int GetRunCount(void) { return total_stability_iterations; } inline int GetRunCount(void) { return total_stability_iterations; }
float GetAvgStability( void ); double GetAvgStability( void );
void SetThetaOnGround(float ff); void SetThetaOnGround(double ff);
void SetPhiOnGround(float ff); void SetPhiOnGround(double ff);
bool initTheta(void); bool initTheta(void);
@ -133,18 +133,18 @@ private:
State state; State state;
Control control; Control control;
float state_value; double state_value;
float control_value; double control_value;
float control_min; double control_min;
float control_max; double control_max;
float tolerance; double tolerance;
float solver_eps; double solver_eps;
float state_convert; double state_convert;
float control_convert; double control_convert;
int max_iterations; int max_iterations;
@ -158,7 +158,7 @@ private:
void getControl(void); void getControl(void);
void setControl(void); void setControl(void);
float computeHmgt(void); double computeHmgt(void);
void Debug(void); void Debug(void);
}; };

View file

@ -62,7 +62,7 @@ FGTurboJet::~FGTurboJet()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGTurboJet::Calculate(float dummy) double FGTurboJet::Calculate(double dummy)
{ {
ConsumeFuel(); ConsumeFuel();
return 0.0; return 0.0;

View file

@ -57,7 +57,7 @@ public:
FGTurboJet(FGFDMExec* exec, FGConfigFile* Eng_cfg); FGTurboJet(FGFDMExec* exec, FGConfigFile* Eng_cfg);
~FGTurboJet(); ~FGTurboJet();
float Calculate(float); double Calculate(double);
private: private:
void Debug(void); void Debug(void);

View file

@ -61,7 +61,7 @@ FGTurboProp::~FGTurboProp()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGTurboProp::Calculate(float dummy) double FGTurboProp::Calculate(double dummy)
{ {
ConsumeFuel(); ConsumeFuel();
return 0.0; return 0.0;

View file

@ -57,7 +57,7 @@ public:
FGTurboProp(FGFDMExec* exec, FGConfigFile* Eng_cfg); FGTurboProp(FGFDMExec* exec, FGConfigFile* Eng_cfg);
~FGTurboProp(); ~FGTurboProp();
float Calculate(float); double Calculate(double);
private: private:
void Debug(void); void Debug(void);
}; };

View file

@ -61,7 +61,7 @@ FGTurboShaft::~FGTurboShaft()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGTurboShaft::Calculate(float dummy) { double FGTurboShaft::Calculate(double dummy) {
ConsumeFuel(); ConsumeFuel();
return 0.0; return 0.0;
} }

View file

@ -57,7 +57,7 @@ public:
FGTurboShaft(FGFDMExec* exec, FGConfigFile* Eng_cfg); FGTurboShaft(FGFDMExec* exec, FGConfigFile* Eng_cfg);
~FGTurboShaft(); ~FGTurboShaft();
float Calculate(float); double Calculate(double);
private: private:
void Debug(void); void Debug(void);
}; };

View file

@ -115,7 +115,7 @@ void FGfdmSocket::Append(const char* item)
size++; size++;
} }
void FGfdmSocket::Append(float item) void FGfdmSocket::Append(double item)
{ {
char s[25]; char s[25];

View file

@ -97,7 +97,7 @@ public:
~FGfdmSocket(); ~FGfdmSocket();
void Send(void); void Send(void);
void Append(const char*); void Append(const char*);
void Append(float); void Append(double);
void Append(long); void Append(long);
void Clear(void); void Clear(void);

View file

@ -133,24 +133,22 @@ int main(int argc, char** argv)
FDMExec = new FGFDMExec(); FDMExec = new FGFDMExec();
if (scripted) { if (scripted) { // form jsbsim <scriptfile>
result = FDMExec->LoadScript(argv[1]); result = FDMExec->LoadScript(argv[1]);
if (!result) { if (!result) {
cerr << "Script file " << argv[1] << " was not successfully loaded" << endl; cerr << "Script file " << argv[1] << " was not successfully loaded" << endl;
exit(-1); exit(-1);
} }
} else { } else { // form jsbsim <acname> <resetfile>
// result = FDMExec->LoadModel("aircraft", "engine", string(argv[1])); if ( ! 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]))) {
cerr << "JSBSim could not be started" << endl; 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);
} }
} }

View file

@ -99,7 +99,7 @@ public:
virtual bool Run(void); virtual bool Run(void);
virtual void SetOutput(void); virtual void SetOutput(void);
inline float GetOutput (void) {return Output;} inline double GetOutput (void) {return Output;}
inline string GetName(void) {return Name;} inline string GetName(void) {return Name;}
protected: protected:
@ -110,10 +110,10 @@ protected:
string Name; string Name;
int ID; int ID;
eParam InputIdx; eParam InputIdx;
float Input; double Input;
string sOutputIdx; string sOutputIdx;
eParam OutputIdx; eParam OutputIdx;
float Output; double Output;
bool IsOutput; bool IsOutput;
virtual void Debug(void); virtual void Debug(void);
}; };

View file

@ -50,7 +50,7 @@ FGFilter::FGFilter(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
AC_cfg(AC_cfg) AC_cfg(AC_cfg)
{ {
string token; string token;
float denom; double denom;
Type = AC_cfg->GetValue("TYPE"); Type = AC_cfg->GetValue("TYPE");
Name = AC_cfg->GetValue("NAME"); Name = AC_cfg->GetValue("NAME");

View file

@ -98,22 +98,22 @@ public:
enum {eLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType; enum {eLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType;
private: private:
float dt; double dt;
float ca; double ca;
float cb; double cb;
float cc; double cc;
float cd; double cd;
float ce; double ce;
float C1; double C1;
float C2; double C2;
float C3; double C3;
float C4; double C4;
float C5; double C5;
float C6; double C6;
float PreviousInput1; double PreviousInput1;
float PreviousInput2; double PreviousInput2;
float PreviousOutput1; double PreviousOutput1;
float PreviousOutput2; double PreviousOutput2;
FGConfigFile* AC_cfg; FGConfigFile* AC_cfg;
void Debug(void); void Debug(void);
}; };

View file

@ -49,8 +49,8 @@ CLASS IMPLEMENTATION
FGFlaps::FGFlaps(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs), FGFlaps::FGFlaps(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
AC_cfg(AC_cfg) { AC_cfg(AC_cfg) {
string token; string token;
float tmpDetent; double tmpDetent;
float tmpTime; double tmpTime;
Detents.clear(); Detents.clear();
TransitionTimes.clear(); TransitionTimes.clear();
@ -109,8 +109,8 @@ FGFlaps::~FGFlaps()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGFlaps::Run(void ) { bool FGFlaps::Run(void ) {
float dt=fcs->GetState()->Getdt(); double dt=fcs->GetState()->Getdt();
float flap_transit_rate=0; double flap_transit_rate=0;
FGFCSComponent::Run(); // call the base class for initialization of Input FGFCSComponent::Run(); // call the base class for initialization of Input
Flap_Handle = Input*Detents[NumDetents-1]; Flap_Handle = Input*Detents[NumDetents-1];

View file

@ -74,12 +74,12 @@ public:
private: private:
FGConfigFile* AC_cfg; FGConfigFile* AC_cfg;
vector<float> Detents; vector<double> Detents;
vector<float> TransitionTimes; vector<double> TransitionTimes;
int NumDetents,fi; int NumDetents,fi;
float lastFlapHandle; double lastFlapHandle;
float Flap_Handle; double Flap_Handle;
float Flap_Position; double Flap_Position;
bool Flaps_In_Transit; bool Flaps_In_Transit;
void Debug(void); void Debug(void);

View file

@ -132,8 +132,8 @@ FGGain::~FGGain()
bool FGGain::Run(void ) bool FGGain::Run(void )
{ {
float SchedGain = 1.0; double SchedGain = 1.0;
float LookupVal = 0; double LookupVal = 0;
FGFCSComponent::Run(); // call the base class for initialization of Input FGFCSComponent::Run(); // call the base class for initialization of Input

View file

@ -77,8 +77,8 @@ private:
FGConfigFile* AC_cfg; FGConfigFile* AC_cfg;
FGTable* Table; FGTable* Table;
FGState* State; FGState* State;
float Gain; double Gain;
float Min, Max; double Min, Max;
int Rows; int Rows;
eParam ScheduledBy; eParam ScheduledBy;

View file

@ -79,7 +79,7 @@ private:
vector <eParam> InputIndices; vector <eParam> InputIndices;
vector <int> InputTypes; vector <int> InputTypes;
bool clip; bool clip;
float clipmin,clipmax; double clipmin,clipmax;
void Debug(void); void Debug(void);
}; };