]> git.mxchange.org Git - flightgear.git/commitdiff
Added a new turbulence type ttStandard, and made it the default.
authordavid <david>
Sun, 16 Mar 2003 21:14:45 +0000 (21:14 +0000)
committerdavid <david>
Sun, 16 Mar 2003 21:14:45 +0000 (21:14 +0000)
ttStandard is copied from ttBerndt, with the following modifications:

1. All turbulence is diminished within three wingspans of the ground.

2. The horizontal forces are used to calculate the moments, but then
   zeroed out so that only the vertical force is actually applied to
   the aircraft.

3. The yaw moment is not used.

In fact, the horizontal forces and the yaw moment should be allowed,
but they are extremely rare compared to the vertical force and the
pitch/roll moments.  For now, simply zeroing them gives the most
accurate feel.

src/FDM/JSBSim/FGAtmosphere.cpp
src/FDM/JSBSim/FGAtmosphere.h

index dcaa9d43c0a94c75dd58bb9672cc62a6de13df9d..e53df6a811976b0823aa3f1a5029382efa599b69 100644 (file)
@@ -89,7 +89,8 @@ FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex)
 
   MagnitudedAccelDt = MagnitudeAccel = Magnitude = 0.0;
 //   turbType = ttNone;
-  turbType = ttBerndt;
+  turbType = ttStandard;
+//   turbType = ttBerndt;
   TurbGain = 0.0;
   
   bind();
@@ -261,6 +262,53 @@ void FGAtmosphere::Calculate(double altitude)
 void FGAtmosphere::Turbulence(void)
 {
   switch (turbType) {
+  case ttStandard: {
+    vDirectiondAccelDt(eX) = 1 - 2.0*(double(rand())/double(RAND_MAX));
+    vDirectiondAccelDt(eY) = 1 - 2.0*(double(rand())/double(RAND_MAX));
+    vDirectiondAccelDt(eZ) = 1 - 2.0*(double(rand())/double(RAND_MAX));
+
+    
+    MagnitudedAccelDt = 1 - 2.0*(double(rand())/double(RAND_MAX)) - Magnitude;
+    MagnitudeAccel    += MagnitudedAccelDt*rate*State->Getdt();
+    Magnitude         += MagnitudeAccel*rate*State->Getdt();
+
+    vDirectiondAccelDt.Normalize();
+    vDirectionAccel += vDirectiondAccelDt*rate*State->Getdt();
+    vDirectionAccel.Normalize();
+    vDirection      += vDirectionAccel*rate*State->Getdt();
+
+    vDirection.Normalize();
+    
+                                // Diminish turbulence within three wingspans
+                                // of the ground
+    vTurbulence = TurbGain*Magnitude * vDirection;
+    double HOverBMAC = Position->GetHOverBMAC();
+    if (HOverBMAC < 3.0)
+        vTurbulence *= (HOverBMAC / 3.0) * (HOverBMAC / 3.0);
+
+    vTurbulenceGrad = TurbGain*MagnitudeAccel * vDirection;
+
+    vBodyTurbGrad = State->GetTl2b()*vTurbulenceGrad;
+    vTurbPQR(eP) = vBodyTurbGrad(eY)/Aircraft->GetWingSpan();
+//     if (Aircraft->GetHTailArm() != 0.0)
+//       vTurbPQR(eQ) = vBodyTurbGrad(eZ)/Aircraft->GetHTailArm();
+//     else
+//       vTurbPQR(eQ) = vBodyTurbGrad(eZ)/10.0;
+
+    if (Aircraft->GetVTailArm())
+      vTurbPQR(eR) = vBodyTurbGrad(eX)/Aircraft->GetVTailArm();
+    else
+      vTurbPQR(eR) = vBodyTurbGrad(eX)/10.0;
+
+                                // Clear the horizontal forces
+                                // actually felt by the plane, now
+                                // that we've used them to calculate
+                                // moments.
+    vTurbulence(eX) = 0.0;
+    vTurbulence(eY) = 0.0;
+
+    break;
+  }
   case ttBerndt: {
     vDirectiondAccelDt(eX) = 1 - 2.0*(double(rand())/double(RAND_MAX));
     vDirectiondAccelDt(eY) = 1 - 2.0*(double(rand())/double(RAND_MAX));
index 4290f1714250029aae888bdb2f325ff29c7e1a41..d70526426ebefba3d45a4522371a13be210efe64 100644 (file)
@@ -161,7 +161,7 @@ public:
 private:
   double rho;
 
-  enum tType {ttBerndt, ttNone} turbType;
+  enum tType {ttStandard, ttBerndt, ttNone} turbType;
 
   int lastIndex;
   double h;