X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGAerodynamics.cpp;h=0f08c01600d0d99d2e44d5db9d54bd1e4e6fc87a;hb=cd24f7b6aaaa54f81655fb574bb050620c900dfe;hp=07e639860592ff333302cad6acaa1b420a433066;hpb=674a295896a1e56d605f39874262d6f146a586a3;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGAerodynamics.cpp b/src/FDM/JSBSim/models/FGAerodynamics.cpp index 07e639860..0f08c0160 100644 --- a/src/FDM/JSBSim/models/FGAerodynamics.cpp +++ b/src/FDM/JSBSim/models/FGAerodynamics.cpp @@ -52,7 +52,7 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGAerodynamics.cpp,v 1.35 2010/11/18 12:38:06 jberndt Exp $"; +static const char *IdSrc = "$Id: FGAerodynamics.cpp,v 1.37 2011/03/11 13:02:26 jberndt Exp $"; static const char *IdHdr = ID_AERODYNAMICS; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -80,7 +80,7 @@ FGAerodynamics::FGAerodynamics(FGFDMExec* FDMExec) : FGModel(FDMExec) axisType = atNone; - Coeff = new CoeffArray[6]; + AeroFunctions = new AeroFunctionArray[6]; impending_stall = stall_hyst = 0.0; alphaclmin = alphaclmax = 0.0; @@ -103,10 +103,10 @@ FGAerodynamics::~FGAerodynamics() unsigned int i,j; for (i=0; i<6; i++) - for (j=0; jGetAuxiliary()->Getalpha(); const double twovel=2*FDMExec->GetAuxiliary()->GetVt(); const double qbar = FDMExec->GetAuxiliary()->Getqbar(); - const double wingarea = FDMExec->GetAircraft()->GetWingArea(); + const double wingarea = FDMExec->GetAircraft()->GetWingArea(); // TODO: Make these constants constant! const double wingspan = FDMExec->GetAircraft()->GetWingSpan(); const double wingchord = FDMExec->GetAircraft()->Getcbar(); const double wingincidence = FDMExec->GetAircraft()->GetWingIncidence(); @@ -177,8 +177,8 @@ bool FGAerodynamics::Run(void) vFnative.InitMatrix(); for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) { - for (ctr=0; ctr < Coeff[axis_ctr].size(); ctr++) { - vFnative(axis_ctr+1) += Coeff[axis_ctr][ctr]->GetValue(); + for (ctr=0; ctr < AeroFunctions[axis_ctr].size(); ctr++) { + vFnative(axis_ctr+1) += AeroFunctions[axis_ctr][ctr]->GetValue(); } } @@ -224,8 +224,8 @@ bool FGAerodynamics::Run(void) vMoments = vDXYZcg*vForces; // M = r X F 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]->GetValue(); + for (ctr = 0; ctr < AeroFunctions[axis_ctr+3].size(); ctr++) { + vMoments(axis_ctr+1) += AeroFunctions[axis_ctr+3][ctr]->GetValue(); } } @@ -349,7 +349,7 @@ bool FGAerodynamics::Load(Element *element) axis_element = document->FindElement("axis"); while (axis_element) { - CoeffArray ca; + AeroFunctionArray ca; axis = axis_element->GetAttributeValue("name"); function_element = axis_element->FindElement("function"); while (function_element) { @@ -363,7 +363,7 @@ bool FGAerodynamics::Load(Element *element) } function_element = axis_element->FindNextElement("function"); } - Coeff[AxisIdx[axis]] = ca; + AeroFunctions[AxisIdx[axis]] = ca; axis_element = document->FindNextElement("axis"); } @@ -388,23 +388,28 @@ void FGAerodynamics::DetermineAxisSystem() string axis; while (axis_element) { axis = axis_element->GetAttributeValue("name"); - if (axis == "LIFT" || axis == "DRAG" || axis == "SIDE") { + if (axis == "LIFT" || axis == "DRAG") { if (axisType == atNone) axisType = atLiftDrag; else if (axisType != atLiftDrag) { cerr << endl << " Mixed aerodynamic axis systems have been used in the" - << " aircraft config file." << endl; + << " aircraft config file. (LIFT DRAG)" << endl; + } + } else if (axis == "SIDE") { + if (axisType != atNone && axisType != atLiftDrag && axisType != atAxialNormal) { + cerr << endl << " Mixed aerodynamic axis systems have been used in the" + << " aircraft config file. (SIDE)" << endl; } } else if (axis == "AXIAL" || axis == "NORMAL") { if (axisType == atNone) axisType = atAxialNormal; else if (axisType != atAxialNormal) { cerr << endl << " Mixed aerodynamic axis systems have been used in the" - << " aircraft config file." << endl; + << " aircraft config file. (NORMAL AXIAL)" << endl; } } else if (axis == "X" || axis == "Y" || axis == "Z") { if (axisType == atNone) axisType = atBodyXYZ; else if (axisType != atBodyXYZ) { cerr << endl << " Mixed aerodynamic axis systems have been used in the" - << " aircraft config file." << endl; + << " aircraft config file. (XYZ)" << endl; } } else if (axis != "ROLL" && axis != "PITCH" && axis != "YAW") { // error cerr << endl << " An unknown axis type, " << axis << " has been specified" @@ -422,35 +427,35 @@ void FGAerodynamics::DetermineAxisSystem() //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -string FGAerodynamics::GetCoefficientStrings(const string& delimeter) const +string FGAerodynamics::GetAeroFunctionStrings(const string& delimeter) const { - string CoeffStrings = ""; + string AeroFunctionStrings = ""; bool firstime = true; unsigned int axis, sd; for (axis = 0; axis < 6; axis++) { - for (sd = 0; sd < Coeff[axis].size(); sd++) { + for (sd = 0; sd < AeroFunctions[axis].size(); sd++) { if (firstime) { firstime = false; } else { - CoeffStrings += delimeter; + AeroFunctionStrings += delimeter; } - CoeffStrings += Coeff[axis][sd]->GetName(); + AeroFunctionStrings += AeroFunctions[axis][sd]->GetName(); } } - return CoeffStrings; + return AeroFunctionStrings; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -string FGAerodynamics::GetCoefficientValues(const string& delimeter) const +string FGAerodynamics::GetAeroFunctionValues(const string& delimeter) const { ostringstream buf; for (unsigned int axis = 0; axis < 6; axis++) { - for (unsigned int sd = 0; sd < Coeff[axis].size(); sd++) { + for (unsigned int sd = 0; sd < AeroFunctions[axis].size(); sd++) { if (buf.tellp() > 0) buf << delimeter; - buf << setw(9) << Coeff[axis][sd]->GetValue(); + buf << setw(9) << AeroFunctions[axis][sd]->GetValue(); } }