From fe4e83a10bfa6927a4925215cbce48433a05ec6e Mon Sep 17 00:00:00 2001 From: andy Date: Sat, 30 Nov 2002 02:24:16 +0000 Subject: [PATCH] Added a tunable "induced drag" number to aircraft. One of the things that 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 | 4 ++-- src/FDM/YASim/FGFDM.cpp | 4 ++++ src/FDM/YASim/Surface.cpp | 13 ++++++++++++- src/FDM/YASim/Surface.hpp | 4 ++++ src/FDM/YASim/Wing.cpp | 3 +++ src/FDM/YASim/Wing.hpp | 2 ++ 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/FDM/YASim/Airplane.cpp b/src/FDM/YASim/Airplane.cpp index f6ab1c610..1a4e7713a 100644 --- a/src/FDM/YASim/Airplane.cpp +++ b/src/FDM/YASim/Airplane.cpp @@ -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 diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index c2f612a17..74bb94a96 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -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); diff --git a/src/FDM/YASim/Surface.cpp b/src/FDM/YASim/Surface.cpp index f94505078..e03fb047c 100644 --- a/src/FDM/YASim/Surface.cpp +++ b/src/FDM/YASim/Surface.cpp @@ -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]; diff --git a/src/FDM/YASim/Surface.hpp b/src/FDM/YASim/Surface.hpp index d3ec43235..cbbbdf619 100644 --- a/src/FDM/YASim/Surface.hpp +++ b/src/FDM/YASim/Surface.hpp @@ -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 diff --git a/src/FDM/YASim/Wing.cpp b/src/FDM/YASim/Wing.cpp index 1434c1e84..42cbb3cfd 100644 --- a/src/FDM/YASim/Wing.cpp +++ b/src/FDM/YASim/Wing.cpp @@ -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; } diff --git a/src/FDM/YASim/Wing.hpp b/src/FDM/YASim/Wing.hpp index f6353ddc9..28eabf826 100644 --- a/src/FDM/YASim/Wing.hpp +++ b/src/FDM/YASim/Wing.hpp @@ -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; -- 2.39.5