]> git.mxchange.org Git - flightgear.git/commitdiff
Added a tunable "induced drag" number to aircraft. One of the things that
authorandy <andy>
Sat, 30 Nov 2002 02:24:16 +0000 (02:24 +0000)
committerandy <andy>
Sat, 30 Nov 2002 02:24:16 +0000 (02:24 +0000)
isn't well-constrained by the solution process is the drag-vs-aoa curve.
The default value that YASim picked was very steep, and resulted in most
of the jets flying their approaches *way* behind the power curve.  This
changes the default to be more forgiving, and adds an "idrag" tunable
to the configuration file for tweakers.

Also, change the default gear springiness to be less stiff.

src/FDM/YASim/Airplane.cpp
src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/Surface.cpp
src/FDM/YASim/Surface.hpp
src/FDM/YASim/Wing.cpp
src/FDM/YASim/Wing.hpp

index f6ab1c610214e485f7d9cc98dab8cf653df47e1f..1a4e7713aff61c400441520dfdbcf44690d69f92 100644 (file)
@@ -618,9 +618,9 @@ void Airplane::solveGear()
         ((GearRec*)_gears.get(i))->wgt /= total;
     
     // The force at max compression should be sufficient to stop a
-    // plane moving downwards at 3x the approach descent rate.  Assume
+    // plane moving downwards at 2x the approach descent rate.  Assume
     // a 3 degree approach.
-    float descentRate = 3.0f*_approachSpeed/19.1f;
+    float descentRate = 2.0f*_approachSpeed/19.1f;
 
     // Spread the kinetic energy according to the gear weights.  This
     // will results in an equal compression fraction (not distance) of
index c2f612a17dd292f804d3d4fb33dc6bf136d4b3a5..74bb94a96e5d91aa9ad2fcde37f7056218ad6422 100644 (file)
@@ -401,6 +401,10 @@ Wing* FGFDM::parseWing(XMLAttributes* a, const char* type)
     w->setCamber(attrf(a, "camber", 0));
     w->setIncidence(attrf(a, "incidence", 0) * DEG2RAD);
 
+    // The 70% is a magic number that sorta kinda seems to match known
+    // throttle settings to approach speed.
+    w->setInducedDrag(0.7*attrf(a, "idrag", 1));
+
     float effect = attrf(a, "effectiveness", 1);
     w->setDragScale(w->getDragScale()*effect);
 
index f945050783140612811524ceee450b882d3c1bf2..e03fb047cff987a6fa1b58efd18b8359c9db58af 100644 (file)
@@ -26,6 +26,7 @@ Surface::Surface()
     _flapLift = 0;
     _slatAlpha = 0;
     _spoilerLift = 1;
+    _inducedDrag = 1;
 }
 
 void Surface::setPosition(float* p)
@@ -146,7 +147,7 @@ void Surface::calcForce(float* v, float rho, float* out, float* torque)
     // Handle the blowup condition.  Zero velocity means zero force by
     // definition.
     if(vel == 0) {
-       int i;
+        int i;
        for(i=0; i<3; i++) out[i] = torque[i] = 0;
        return;
     }
@@ -161,6 +162,11 @@ void Surface::calcForce(float* v, float rho, float* out, float* torque)
     // by small rotations.
     out[2] += _incidence * out[0]; // z' = z + incidence * x
 
+    // Hold onto the local wind vector so we can multiply the induced
+    // drag at the end.
+    float lwind[3];
+    Math::set3(out, lwind);
+    
     // Diddle the Z force according to our configuration
     float stallMul = stallFunc(out);
     stallMul *= 1 + _spoilerPos * (_spoilerLift - 1);
@@ -188,6 +194,11 @@ void Surface::calcForce(float* v, float rho, float* out, float* torque)
     // Add in any specific Y (side force) coefficient.
     out[1] *= _cy;
 
+    // Diddle the induced drag
+    float IDMUL = 0.5;
+    Math::mul3(-1*_inducedDrag*out[2]*lwind[2], lwind, lwind);
+    Math::add3(lwind, out, out);
+
     // Reverse the incidence rotation to get back to surface
     // coordinates.
     out[2] -= _incidence * out[0];
index d3ec43235f06ff7a10eb31af77b57a7d4b2d9088..cbbbdf61912066f9508e25329495b7b9c76ba380 100644 (file)
@@ -59,6 +59,9 @@ public:
     void setStall(int i, float alpha);
     void setStallWidth(int i, float width);
 
+    // Induced drag multiplier
+    void setInducedDrag(float mul) { _inducedDrag = mul; }
+
     void calcForce(float* v, float rho, float* forceOut, float* torqueOut);
 
 private:
@@ -89,6 +92,7 @@ private:
     float _flapPos;
     float _spoilerPos;
     float _incidence;
+    float _inducedDrag;
 };
 
 }; // namespace yasim
index 1434c1e84611600cf191106a4bf8303fdd7ad1bc..42cbb3cfdfb3aa383bc90ef0721fc9549ba994e8 100644 (file)
@@ -17,6 +17,7 @@ Wing::Wing()
     _stallPeak = 0;
     _camber = 0;
     _incidence = 0;
+    _inducedDrag = 1;
     _dragScale = 1;
     _liftRatio = 1;
     _flap0Start = 0;
@@ -435,6 +436,8 @@ Surface* Wing::newSurface(float* pos, float* orient, float chord,
     if(slat)    _slatSurfs.add(s);
     if(spoiler) _spoilerSurfs.add(s);
 
+    s->setInducedDrag(_inducedDrag);
+
     return s;
 }
 
index f6353ddc9c28a49942f5f4a424295ada9e74c0cb..28eabf826a27537716edbdb794a3c35da9550928 100644 (file)
@@ -29,6 +29,7 @@ public:
     void setStallPeak(float fraction);
     void setCamber(float camber);
     void setIncidence(float incidence);
+    void setInducedDrag(float drag) { _inducedDrag = drag; }
     
     void setFlap0(float start, float end, float lift, float drag);
     void setFlap1(float start, float end, float lift, float drag);
@@ -93,6 +94,7 @@ private:
     float _stallPeak;
     float _camber;
     float _incidence;
+    float _inducedDrag;
 
     float _dragScale;
     float _liftRatio;