-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Module: FGAircraft.cpp
Author: Jon S. Berndt
point to config file. Added calculations for moments due to
difference in cg and aero reference point
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
[1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
School, January 1994
CnDr - Yaw moment due to rudder
CnDa - Yaw moment due to aileron
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <sys/stat.h>
#include <sys/types.h>
#include "FGAuxiliary.h"
#include "FGOutput.h"
-/*******************************************************************************
-************************************ CODE **************************************
-*******************************************************************************/
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+GLOBAL DATA
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+static const char *IdSrc = "$Id$";
+static const char *IdHdr = ID_AIRCRAFT;
+
+extern char highint[5];
+extern char halfint[5];
+extern char normint[6];
+extern char reset[5];
+extern char underon[5];
+extern char underoff[6];
+extern char fgblue[6];
+extern char fgcyan[6];
+extern char fgred[6];
+extern char fggreen[6];
+extern char fgdef[6];
+
+extern short debug_lvl;
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS IMPLEMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex),
vMoments(3),
vXYZcg(3),
vXYZep(3),
vEuler(3)
-
+
{
Name = "FGAircraft";
AxisIdx["PITCH"] = 4;
AxisIdx["YAW"] = 5;
+ Coeff = new CoeffArray[6];
+
GearUp = false;
- numTanks = numEngines = numSelectedFuelTanks = numSelectedOxiTanks = 0;
+ alphaclmin = alphaclmax = 0;
+
+ if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGAircraft::~FGAircraft(void) {}
+FGAircraft::~FGAircraft() {
+ unsigned int i,j;
+ for (i=0; i<6; i++) {
+ for (j=0; j<Coeff[i].size(); j++) {
+ delete Coeff[i][j];
+ }
+ }
+ delete[] Coeff;
+
+ if (debug_lvl & 2) cout << "Destroyed: FGAircraft" << endl;
+}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string fname) {
string path;
AircraftPath = aircraft_path;
EnginePath = engine_path;
- aircraftCfgFileName = AircraftPath + "/" + fname + "/" + fname + ".cfg";
+# ifndef macintosh
+ aircraftCfgFileName = AircraftPath + "/" + fname + "/" + fname + ".xml";
+# else
+ aircraftCfgFileName = AircraftPath + ";" + fname + ";" + fname + ".xml";
+# endif
FGConfigFile AC_cfg(aircraftCfgFileName);
if (!AC_cfg.IsOpen()) return false;
while ((AC_cfg.GetNextConfigLine() != "EOF") &&
(token = AC_cfg.GetValue()) != "/FDM_CONFIG") {
if (token == "METRICS") {
- cout << " Reading Metrics" << endl;
+ cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
ReadMetrics(&AC_cfg);
} else if (token == "AERODYNAMICS") {
- cout << " Reading Aerodynamics" << endl;
+ cout << fgcyan << "\n Reading Aerodynamics" << fgdef << endl;
ReadAerodynamics(&AC_cfg);
} else if (token == "UNDERCARRIAGE") {
- cout << " Reading Landing Gear" << endl;
+ cout << fgcyan << "\n Reading Landing Gear" << fgdef << endl;
ReadUndercarriage(&AC_cfg);
} else if (token == "PROPULSION") {
- cout << " Reading Propulsion" << endl;
+ cout << fgcyan << "\n Reading Propulsion" << fgdef << endl;
ReadPropulsion(&AC_cfg);
} else if (token == "FLIGHT_CONTROL") {
- cout << " Reading Flight Control" << endl;
+ cout << fgcyan << "\n Reading Flight Control" << fgdef << endl;
ReadFlightControls(&AC_cfg);
} else if (token == "OUTPUT") {
+ cout << fgcyan << "\n Reading Output directives" << fgdef << endl;
ReadOutput(&AC_cfg);
}
}
return true;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGAircraft::Run(void) {
if (!FGModel::Run()) { // if false then execute this Run()
FMGear();
FMMass();
- nlf=vFs(eZ)/Weight;
+ nlf = 0;
+ if (fabs(Position->GetGamma()) < 1.57) {
+ nlf = vFs(eZ)/(Weight*cos(Position->GetGamma()));
+ }
+
} else { // skip Run() execution this time
}
return false;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::MassChange() {
static FGColumnVector vXYZtank(3);
float Tw;
float IXXt, IYYt, IZZt, IXZt;
- unsigned int t;
- unsigned int axis_ctr;
-
+// unsigned int t;
+// unsigned int axis_ctr;
+/*
for (axis_ctr=1; axis_ctr<=3; axis_ctr++) vXYZtank(axis_ctr) = 0.0;
// UPDATE TANK CONTENTS
if ((Fshortage <= 0.0) || (Oshortage <= 0.0)) Engine[e]->SetStarved();
else Engine[e]->SetStarved(false);
}
-
+*/
Weight = EmptyWeight;
- for (t=0; t<numTanks; t++)
- Weight += Tank[t]->GetContents();
+// for (t=0; t<numTanks; t++)
+// Weight += Tank[t]->GetContents();
Mass = Weight / GRAVITY;
// Calculate new CG here.
Tw = 0;
- for (t=0; t<numTanks; t++) {
- vXYZtank(eX) += Tank[t]->GetX()*Tank[t]->GetContents();
- vXYZtank(eY) += Tank[t]->GetY()*Tank[t]->GetContents();
- vXYZtank(eZ) += Tank[t]->GetZ()*Tank[t]->GetContents();
-
- Tw += Tank[t]->GetContents();
- }
+// for (t=0; t<numTanks; t++) {
+// vXYZtank(eX) += Tank[t]->GetX()*Tank[t]->GetContents();
+// vXYZtank(eY) += Tank[t]->GetY()*Tank[t]->GetContents();
+// vXYZtank(eZ) += Tank[t]->GetZ()*Tank[t]->GetContents();
+//
+// Tw += Tank[t]->GetContents();
+// }
vXYZcg = (vXYZtank + EmptyWeight*vbaseXYZcg) / (Tw + EmptyWeight);
// Calculate new moments of inertia here
IXXt = IYYt = IZZt = IXZt = 0.0;
- for (t=0; t<numTanks; t++) {
- IXXt += ((Tank[t]->GetX()-vXYZcg(eX))/12.0)*((Tank[t]->GetX() - vXYZcg(eX))/12.0)*Tank[t]->GetContents()/GRAVITY;
- IYYt += ((Tank[t]->GetY()-vXYZcg(eY))/12.0)*((Tank[t]->GetY() - vXYZcg(eY))/12.0)*Tank[t]->GetContents()/GRAVITY;
- IZZt += ((Tank[t]->GetZ()-vXYZcg(eZ))/12.0)*((Tank[t]->GetZ() - vXYZcg(eZ))/12.0)*Tank[t]->GetContents()/GRAVITY;
- IXZt += ((Tank[t]->GetX()-vXYZcg(eX))/12.0)*((Tank[t]->GetZ() - vXYZcg(eZ))/12.0)*Tank[t]->GetContents()/GRAVITY;
- }
+// for (t=0; t<numTanks; t++) {
+// IXXt += ((Tank[t]->GetX()-vXYZcg(eX))/12.0)*((Tank[t]->GetX() - vXYZcg(eX))/12.0)*Tank[t]->GetContents()/GRAVITY;
+// IYYt += ((Tank[t]->GetY()-vXYZcg(eY))/12.0)*((Tank[t]->GetY() - vXYZcg(eY))/12.0)*Tank[t]->GetContents()/GRAVITY;
+// IZZt += ((Tank[t]->GetZ()-vXYZcg(eZ))/12.0)*((Tank[t]->GetZ() - vXYZcg(eZ))/12.0)*Tank[t]->GetContents()/GRAVITY;
+// IXZt += ((Tank[t]->GetX()-vXYZcg(eX))/12.0)*((Tank[t]->GetZ() - vXYZcg(eZ))/12.0)*Tank[t]->GetContents()/GRAVITY;
+// }
Ixx = baseIxx + IXXt;
Iyy = baseIyy + IYYt;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::FMAero(void) {
static FGColumnVector vDXYZcg(3);
for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
for (ctr=0; ctr < Coeff[axis_ctr].size(); ctr++) {
- vFs(axis_ctr+1) += Coeff[axis_ctr][ctr].TotalValue();
+ vFs(axis_ctr+1) += Coeff[axis_ctr][ctr]->TotalValue();
}
}
vAeroBodyForces = State->GetTs2b(alpha, beta)*vFs;
vForces += vAeroBodyForces;
- // The d*cg distances below, given in inches, are the distances FROM the c.g.
- // TO the reference point. Since the c.g. and ref point are given in inches in
- // the structural system (X positive rearwards) and the body coordinate system
- // is given with X positive out the nose, the dxcg and dzcg values are
- // *rotated* 180 degrees about the Y axis.
+ // see http://home.earthlink.net/~apeden/jsbsim_moments_due_to_forces.txt
+ // for details on this
vDXYZcg(eX) = -(vXYZrp(eX) - vXYZcg(eX))/12.0; //cg and rp values are in inches
vDXYZcg(eY) = (vXYZrp(eY) - vXYZcg(eY))/12.0;
vDXYZcg(eZ) = -(vXYZrp(eZ) - vXYZcg(eZ))/12.0;
for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
for (ctr = 0; ctr < Coeff[axis_ctr+3].size(); ctr++) {
- vMoments(axis_ctr+1) += Coeff[axis_ctr+3][ctr].TotalValue();
+ vMoments(axis_ctr+1) += Coeff[axis_ctr+3][ctr]->TotalValue();
}
}
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::FMGear(void) {
- if (GearUp) {
- // crash routine
- }
- else {
- for (unsigned int i=0;i<lGear.size();i++) {
- vForces += lGear[i]->Force();
- vMoments += lGear[i]->Moment();
+
+ if ( !GearUp ) {
+ vector <FGLGear>::iterator iGear = lGear.begin();
+ while (iGear != lGear.end()) {
+ vForces += iGear->Force();
+ vMoments += iGear->Moment();
+ iGear++;
}
+ } else {
+ // Crash Routine
}
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::FMMass(void) {
vForces(eX) += -GRAVITY*sin(vEuler(eTht)) * Mass;
vForces(eZ) += GRAVITY*cos(vEuler(ePhi))*cos(vEuler(eTht)) * Mass;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::FMProp(void) {
- for (unsigned int i=0;i<numEngines;i++) {
-
- // Changes required here for new engine placement parameters (i.e. location and direction)
-
- vForces(eX) += Engine[i]->CalcThrust();
- }
-
+ vForces += Propulsion->GetForces();
+ vMoments += Propulsion->GetMoments();
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::GetState(void) {
dt = State->Getdt();
vEuler = Rotation->GetEuler();
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg) {
string token = "";
cout << " EmptyWeight: " << EmptyWeight << endl;
} else if (parameter == "AC_CGLOC") {
*AC_cfg >> vbaseXYZcg(eX) >> vbaseXYZcg(eY) >> vbaseXYZcg(eZ);
- cout << " Xcg: " << vbaseXYZcg(eX)
- << " Ycg: " << vbaseXYZcg(eY)
- << " Zcg: " << vbaseXYZcg(eZ)
- << endl;
+ cout << " CG (x, y, z): " << vbaseXYZcg << endl;
} else if (parameter == "AC_EYEPTLOC") {
*AC_cfg >> vXYZep(eX) >> vXYZep(eY) >> vXYZep(eZ);
- cout << " Xep: " << vXYZep(eX)
- << " Yep: " << vXYZep(eY)
- << " Zep: " << vXYZep(eZ)
- << endl;
+ cout << " Eyepoint (x, y, z): " << vXYZep << endl;
} else if (parameter == "AC_AERORP") {
*AC_cfg >> vXYZrp(eX) >> vXYZrp(eY) >> vXYZrp(eZ);
- cout << " Xrp: " << vXYZrp(eX)
- << " Yrp: " << vXYZrp(eY)
- << " Zrp: " << vXYZrp(eZ)
- << endl;
+ cout << " Ref Pt (x, y, z): " << vXYZrp << endl;
} else if (parameter == "AC_ALPHALIMITS") {
*AC_cfg >> alphaclmin >> alphaclmax;
cout << " Maximum Alpha: " << alphaclmax
- << " Minimum Alpha: " << alphaclmin
+ << " Minimum Alpha: " << alphaclmin
<< endl;
}
}
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::ReadPropulsion(FGConfigFile* AC_cfg) {
- string token;
- string engine_name;
- string parameter;
-
- AC_cfg->GetNextConfigLine();
-
- while ((token = AC_cfg->GetValue()) != "/PROPULSION") {
- *AC_cfg >> parameter;
-
- if (parameter == "AC_ENGINE") {
-
- *AC_cfg >> engine_name;
- Engine[numEngines] = new FGEngine(FDMExec, EnginePath, engine_name, numEngines);
- numEngines++;
-
- } else if (parameter == "AC_TANK") {
-
- Tank[numTanks] = new FGTank(AC_cfg);
- switch(Tank[numTanks]->GetType()) {
- case FGTank::ttFUEL:
- numSelectedFuelTanks++;
- break;
- case FGTank::ttOXIDIZER:
- numSelectedOxiTanks++;
- break;
- }
- numTanks++;
- }
+ if (!Propulsion->LoadPropulsion(AC_cfg)) {
+ cerr << "Propulsion not successfully loaded" << endl;
}
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::ReadFlightControls(FGConfigFile* AC_cfg) {
- string token;
-
- FCS->LoadFCS(AC_cfg);
+ if (!FCS->LoadFCS(AC_cfg)) {
+ cerr << "Flight Controls not successfully loaded" << endl;
+ }
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::ReadAerodynamics(FGConfigFile* AC_cfg) {
string token, axis;
AC_cfg->GetNextConfigLine();
-
- Coeff.push_back(*(new CoeffArray()));
- Coeff.push_back(*(new CoeffArray()));
- Coeff.push_back(*(new CoeffArray()));
- Coeff.push_back(*(new CoeffArray()));
- Coeff.push_back(*(new CoeffArray()));
- Coeff.push_back(*(new CoeffArray()));
-
+
while ((token = AC_cfg->GetValue()) != "/AERODYNAMICS") {
if (token == "AXIS") {
+ CoeffArray ca;
axis = AC_cfg->GetValue("NAME");
AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/AXIS") {
- Coeff[AxisIdx[axis]].push_back(*(new FGCoefficient(FDMExec, AC_cfg)));
- DisplayCoeffFactors(Coeff[AxisIdx[axis]].back().Getmultipliers());
+ ca.push_back(new FGCoefficient(FDMExec, AC_cfg));
+ DisplayCoeffFactors(ca.back()->Getmultipliers());
}
+ Coeff[AxisIdx[axis]]=ca;
AC_cfg->GetNextConfigLine();
}
}
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg) {
string token;
AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/UNDERCARRIAGE") {
- lGear.push_back(new FGLGear(AC_cfg, FDMExec));
+ lGear.push_back(FGLGear(AC_cfg, FDMExec));
}
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGAircraft::ReadOutput(FGConfigFile* AC_cfg) {
string token, parameter;
*AC_cfg >> parameter;
if (parameter == "ON") subsystems += ssGroundReactions;
}
+ if (parameter == "FCS") {
+ *AC_cfg >> parameter;
+ if (parameter == "ON") subsystems += ssFCS;
+ }
}
Output->SetSubsystems(subsystems);
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");
- cout << "Reading Aircraft Configuration File: " << AircraftName << endl;
- scratch=AC_cfg->GetValue("VERSION").c_str();
+ cout << underon << "Reading Aircraft Configuration File" << underoff << ": "
+ << highint << AircraftName << normint << endl;
+ scratch = AC_cfg->GetValue("VERSION").c_str();
CFGVersion = AC_cfg->GetValue("VERSION");
- cout << " Version: " << CFGVersion << endl;
+ cout << " Version: " << highint << CFGVersion
+ << normint << endl;
if (CFGVersion != NEEDED_CFG_VERSION) {
- cout << endl << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
+ cout << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
" RESULTS WILL BE UNPREDICTABLE !!" << endl;
cout << "Current version needed is: " << NEEDED_CFG_VERSION << endl;
- cout << " You have version: " << CFGVersion << endl << endl;
+ cout << " You have version: " << CFGVersion << endl << fgdef << endl;
//exit(-1);
}
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGAircraft::DisplayCoeffFactors(int multipliers) {
+void FGAircraft::DisplayCoeffFactors(vector <eParam> multipliers) {
cout << " Non-Dimensionalized by: ";
- if (multipliers & FG_QBAR) cout << "qbar ";
- if (multipliers & FG_WINGAREA) cout << "S ";
- if (multipliers & FG_WINGSPAN) cout << "b ";
- if (multipliers & FG_CBAR) cout << "c ";
- if (multipliers & FG_ALPHA) cout << "alpha ";
- if (multipliers & FG_ALPHADOT) cout << "alphadot ";
- if (multipliers & FG_BETA) cout << "beta ";
- if (multipliers & FG_BETADOT) cout << "betadot ";
- if (multipliers & FG_PITCHRATE) cout << "q ";
- if (multipliers & FG_ROLLRATE) cout << "p ";
- if (multipliers & FG_YAWRATE) cout << "r ";
-
- if (multipliers & FG_ELEVATOR_CMD) cout << "De cmd ";
- if (multipliers & FG_AILERON_CMD) cout << "Da cmd ";
- if (multipliers & FG_RUDDER_CMD) cout << "Dr cmd ";
- if (multipliers & FG_FLAPS_CMD) cout << "Df cmd ";
- if (multipliers & FG_SPOILERS_CMD) cout << "Dsp cmd ";
- if (multipliers & FG_SPDBRAKE_CMD) cout << "Dsb cmd ";
-
- if (multipliers & FG_ELEVATOR_POS) cout << "De ";
- if (multipliers & FG_AILERON_POS) cout << "Da ";
- if (multipliers & FG_RUDDER_POS) cout << "Dr ";
- if (multipliers & FG_FLAPS_POS) cout << "Df ";
- if (multipliers & FG_SPOILERS_POS) cout << "Dsp ";
- if (multipliers & FG_SPDBRAKE_POS) cout << "Dsb ";
-
- if (multipliers & FG_MACH) cout << "Mach ";
- if (multipliers & FG_ALTITUDE) cout << "h ";
- if (multipliers & FG_BI2VEL) cout << "b /(2*Vt) ";
- if (multipliers & FG_CI2VEL) cout << "c /(2*Vt) ";
+ for (unsigned int i=0; i<multipliers.size();i++)
+ cout << State->paramdef[multipliers[i]];
cout << endl;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGAircraft::GetCoefficientStrings(void) {
string CoeffStrings = "";
} else {
CoeffStrings += ", ";
}
- CoeffStrings += Coeff[axis][sd].Getname();
+ CoeffStrings += Coeff[axis][sd]->Getname();
}
}
return CoeffStrings;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGAircraft::GetCoefficientValues(void) {
string SDValues = "";
} else {
SDValues += ", ";
}
- sprintf(buffer, "%9.6f", Coeff[axis][sd].GetSD());
+ sprintf(buffer, "%9.6f", Coeff[axis][sd]->GetSD());
SDValues += string(buffer);
}
}
return SDValues;
- ;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGAircraft::GetGroundReactionStrings(void) {
string GroundReactionStrings = "";
for (unsigned int i=0;i<lGear.size();i++) {
if (!firstime) GroundReactionStrings += ", ";
- GroundReactionStrings += (lGear[i]->GetName() + "_WOW, ");
- GroundReactionStrings += (lGear[i]->GetName() + "_compressLength, ");
- GroundReactionStrings += (lGear[i]->GetName() + "_compressSpeed, ");
- GroundReactionStrings += (lGear[i]->GetName() + "_Force");
+ GroundReactionStrings += (lGear[i].GetName() + "_WOW, ");
+ GroundReactionStrings += (lGear[i].GetName() + "_compressLength, ");
+ GroundReactionStrings += (lGear[i].GetName() + "_compressSpeed, ");
+ GroundReactionStrings += (lGear[i].GetName() + "_Force");
firstime = false;
}
return GroundReactionStrings;
}
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGAircraft::GetGroundReactionValues(void) {
char buff[20];
for (unsigned int i=0;i<lGear.size();i++) {
if (!firstime) GroundReactionValues += ", ";
- GroundReactionValues += string( lGear[i]->GetWOW()?"1":"0" ) + ", ";
- GroundReactionValues += (string(gcvt(lGear[i]->GetCompLen(), 5, buff)) + ", ");
- GroundReactionValues += (string(gcvt(lGear[i]->GetCompVel(), 6, buff)) + ", ");
- GroundReactionValues += (string(gcvt(lGear[i]->GetCompForce(), 10, buff)));
+ GroundReactionValues += string( lGear[i].GetWOW()?"1":"0" ) + ", ";
+ GroundReactionValues += (string(gcvt(lGear[i].GetCompLen(), 5, buff)) + ", ");
+ GroundReactionValues += (string(gcvt(lGear[i].GetCompVel(), 6, buff)) + ", ");
+ GroundReactionValues += (string(gcvt(lGear[i].GetCompForce(), 10, buff)));
firstime = false;
}
return GroundReactionValues;
}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGAircraft::Debug(void)
+{
+ //TODO: Add your source code here
+}
+