]> git.mxchange.org Git - flightgear.git/commitdiff
Added a "twist" attribute for wings to allow for washout (or washin,
authordavid <david>
Tue, 18 Feb 2003 16:50:07 +0000 (16:50 +0000)
committerdavid <david>
Tue, 18 Feb 2003 16:50:07 +0000 (16:50 +0000)
if desired) in the stall.  This allows for fairly docile stalls when
desired, as on trainers (you also need to limit the elevator lift).

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 81b50bfb6a9ea95bcb6bc065e9ba5ef330ddf6f2..e959df3c781f55e393fe0feb34fe193a18c13cbc 100644 (file)
@@ -415,6 +415,7 @@ Wing* FGFDM::parseWing(XMLAttributes* a, const char* type)
     w->setDihedral(attrf(a, "dihedral", defDihed) * DEG2RAD);
     w->setCamber(attrf(a, "camber", 0));
     w->setIncidence(attrf(a, "incidence", 0) * DEG2RAD);
+    w->setTwist(attrf(a, "twist", 0) * DEG2RAD);
 
     // The 70% is a magic number that sorta kinda seems to match known
     // throttle settings to approach speed.
index e03fb047cff987a6fa1b58efd18b8359c9db58af..3ac62b524c105a17baf0317ad7695f3d513c578f 100644 (file)
@@ -20,6 +20,7 @@ Surface::Surface()
     
     _chord = 0;
     _incidence = 0;
+    _twist = 0;
     _slatPos = _spoilerPos = _flapPos = 0;
     _slatDrag = _spoilerDrag = _flapDrag = 1;
 
@@ -103,6 +104,11 @@ void Surface::setIncidence(float angle)
     _incidence = angle;
 }
 
+void Surface::setTwist(float angle)
+{
+    _twist = angle;
+}
+
 void Surface::setSlatParams(float stallDelta, float dragPenalty)
 {
     _slatAlpha = stallDelta;
@@ -160,7 +166,8 @@ void Surface::calcForce(float* v, float rho, float* out, float* torque)
     // "Rotate" by the incidence angle.  Assume small angles, so we
     // need to diddle only the Z component, X is relatively unchanged
     // by small rotations.
-    out[2] += _incidence * out[0]; // z' = z + incidence * x
+    float incidence = _incidence + _twist;
+    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.
@@ -201,7 +208,7 @@ void Surface::calcForce(float* v, float rho, float* out, float* torque)
 
     // Reverse the incidence rotation to get back to surface
     // coordinates.
-    out[2] -= _incidence * out[0];
+    out[2] -= incidence * out[0];
 
     // Convert back to external coordinates
     Math::tmul33(_orient, out, out);
index cbbbdf61912066f9508e25329495b7b9c76ba380..1b55e3c45813ead38c237e37e7f33634ca773459 100644 (file)
@@ -42,6 +42,9 @@ public:
     // positive is "up" (i.e. "positive AoA")
     void setIncidence(float angle);
 
+    // The offset from base incidence for this surface.
+    void setTwist(float angle);
+
     void setTotalDrag(float c0);
     float getTotalDrag();
 
@@ -92,6 +95,7 @@ private:
     float _flapPos;
     float _spoilerPos;
     float _incidence;
+    float _twist;
     float _inducedDrag;
 };
 
index 42cbb3cfdfb3aa383bc90ef0721fc9549ba994e8..9899df8be6d395e0fc449869c53d0c294589f52f 100644 (file)
@@ -15,6 +15,7 @@ Wing::Wing()
     _stall = 0;
     _stallWidth = 0;
     _stallPeak = 0;
+    _twist = 0;
     _camber = 0;
     _incidence = 0;
     _inducedDrag = 1;
@@ -114,6 +115,11 @@ void Wing::setStallPeak(float fraction)
     _stallPeak = fraction;
 }
 
+void Wing::setTwist(float angle)
+{
+    _twist = angle;
+}
+
 void Wing::setCamber(float camber)
 {
     _camber = camber;
@@ -324,6 +330,8 @@ void Wing::compile()
         // and flap1 are set.  Right now flap1 overrides.
 
         int nSegs = (int)Math::ceil((end-start)/segLen);
+        if (_twist != 0 && nSegs < 16) // more segments if twisted
+            nSegs = 16;
         float segWid = _length * (end - start)/nSegs;
 
         int j;
@@ -341,6 +349,7 @@ void Wing::compile()
             sr->surface = s;
             sr->weight = chord * segWid;
             s->setTotalDrag(sr->weight);
+            s->setTwist(_twist * Math::sqrt(1-frac));
             _surfs.add(sr);
 
             if(_mirror) {
@@ -351,6 +360,7 @@ void Wing::compile()
                 sr->surface = s;
                 sr->weight = chord * segWid;
                 s->setTotalDrag(sr->weight);
+                s->setTwist(_twist * Math::sqrt(frac));
                 _surfs.add(sr);
             }
         }
index 28eabf826a27537716edbdb794a3c35da9550928..5052d7a26b4b1bf7ec393375af984ec3598c4f69 100644 (file)
@@ -27,6 +27,7 @@ public:
     void setStall(float aoa);
     void setStallWidth(float angle);
     void setStallPeak(float fraction);
+    void setTwist(float angle);
     void setCamber(float camber);
     void setIncidence(float incidence);
     void setInducedDrag(float drag) { _inducedDrag = drag; }
@@ -92,6 +93,7 @@ private:
     float _stall;
     float _stallWidth;
     float _stallPeak;
+    float _twist;
     float _camber;
     float _incidence;
     float _inducedDrag;