]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGAerodynamics.cpp
Better fix for a compilation problem with MSVC 2012
[flightgear.git] / src / FDM / JSBSim / models / FGAerodynamics.cpp
index 13a9b9f17b09887ca5bcb30bba41a263d21967df..ed1d639fce787d7fdc4a93f61ff00e41c7026342 100644 (file)
@@ -48,7 +48,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGAerodynamics.cpp,v 1.41 2011/08/04 12:46:32 jberndt Exp $";
+static const char *IdSrc = "$Id: FGAerodynamics.cpp,v 1.45 2012/04/13 13:25:52 jberndt Exp $";
 static const char *IdHdr = ID_AERODYNAMICS;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -208,13 +208,15 @@ bool FGAerodynamics::Run(bool Holding)
   if ( fabs(vFw(eDrag)) > 0.0) lod = fabs( vFw(eLift) / vFw(eDrag) );
 
   // Calculate aerodynamic reference point shift, if any. The shift
-  // takes place in the body axis. That is, if the shift is negative,
+  // takes place in the structual axis. That is, if the shift is positive,
   // it is towards the back (tail) of the vehicle. The AeroRPShift
   // function should be non-dimensionalized by the wing chord. The
   // calculated vDeltaRP will be in feet.
   if (AeroRPShift) vDeltaRP(eX) = AeroRPShift->GetValue()*in.Wingchord;
 
-  vDXYZcg = in.RPBody + vDeltaRP;
+  vDXYZcg(eX) = in.RPBody(eX) - vDeltaRP(eX); // vDeltaRP is given in the structural frame
+  vDXYZcg(eY) = in.RPBody(eY) + vDeltaRP(eY);
+  vDXYZcg(eZ) = in.RPBody(eZ) - vDeltaRP(eZ);
 
   vMoments = vDXYZcg*vForces; // M = r X F
 
@@ -370,6 +372,17 @@ string FGAerodynamics::GetAeroFunctionStrings(const string& delimeter) const
       AeroFunctionStrings += AeroFunctions[axis][sd]->GetName();
     }
   }
+
+  string FunctionStrings = FGModelFunctions::GetFunctionStrings(delimeter);
+
+  if (FunctionStrings.size() > 0) {
+    if (AeroFunctionStrings.size() > 0) {
+      AeroFunctionStrings += delimeter + FunctionStrings;
+    } else {
+      AeroFunctionStrings = FunctionStrings;
+    }
+  }
+
   return AeroFunctionStrings;
 }
 
@@ -382,7 +395,17 @@ string FGAerodynamics::GetAeroFunctionValues(const string& delimeter) const
   for (unsigned int axis = 0; axis < 6; axis++) {
     for (unsigned int sd = 0; sd < AeroFunctions[axis].size(); sd++) {
       if (buf.tellp() > 0) buf << delimeter;
-      buf << setw(9) << AeroFunctions[axis][sd]->GetValue();
+      buf << AeroFunctions[axis][sd]->GetValue();
+    }
+  }
+
+  string FunctionValues = FGModelFunctions::GetFunctionValues(delimeter);
+
+  if (FunctionValues.size() > 0) {
+    if (buf.str().size() > 0) {
+      buf << delimeter << FunctionValues;
+    } else {
+      buf << FunctionValues;
     }
   }