1
0
Fork 0
flightgear/src/FDM/YASim/Surface.hpp
Colin Douglas Howell 54f954fd02 Fix for issue 1463 (YASim underestimates off-axis aerodynamic forces on fuselages)
Change the drag coefficient for fuselages along the Y and Z axes
(i.e. perpendicular to the fuselage's main axis) to use a fixed
value of 0.5. (The value can still be adjusted using the fuselage's
"cy" and "cz" XML attributes.)

For the Y-axis and Z-axis drag on fuselages, YASim originally used
a drag coefficient equal to:

	(solver drag factor) * (fuselage length/width ratio)

This value turns out to be way too small for well-streamlined
aircraft, even those with long, narrow fuselages, and especially
so for those with short, stubby fuselages. Such fuselages are
streamlined in the X direction, but not along Y or Z.

0.5 is only a ballpark estimate, but it's reasonably close for the
common case of a fairly long fuselage with a round cross section. For
flat-sided fuselages, a larger value should be used, up to a maximum
of 2 for a slab-sided block. For short fuselages, the value should be
reduced to account for end effects. The fuselage's "cy" and "cz" XML
attributes can be modified to make such adjustments.

This fix won't affect straight flight much, but it should have a strong
impact on some maneuvers. For example, it will make slips more
effective and may make knife-edge flight easier on aerobatic aircraft
which should be capable of it.

Only aircraft which specify version="YASIM_VERSION_32" or newer are
affected.
2014-05-12 19:07:10 -07:00

113 lines
3.3 KiB
C++

#ifndef _SURFACE_HPP
#define _SURFACE_HPP
#include "Version.hpp"
namespace yasim {
// FIXME: need a "chord" member for calculating moments. Generic
// forces act at the center, but "pre-stall" lift acts towards the
// front, and flaps act (in both lift and drag) toward the back.
class Surface
{
public:
Surface( Version * version );
// Position of this surface in local coords
void setPosition(float* p);
void getPosition(float* out);
// Distance scale along the X axis
void setChord(float chord);
// Slats act to move the stall peak by the specified angle, and
// increase drag by the multiplier specified.
void setSlatParams(float stallDelta, float dragPenalty);
// Flaps add to lift coefficient, and multiply drag.
void setFlapParams(float liftAdd, float dragPenalty);
// Spoilers reduce the pre-stall lift, and multiply drag.
void setSpoilerParams(float liftPenalty, float dragPenalty);
// Positions for the controls, in the range [0:1]. [-1:1] for
// flaps, with positive meaning "force goes towards positive Z"
void setFlap(float pos);
void setSlat(float pos);
void setSpoiler(float pos);
// Modifier for flap lift coefficient, useful for simulating flap blowing etc.
void setFlapEffectiveness(float effectiveness);
double getFlapEffectiveness();
// local -> Surface coords
void setOrientation(float* o);
// For variable-incidence control surfaces. The angle is a
// negative rotation about the surface's Y axis, in radians, so
// 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();
void setXDrag(float cx);
void setYDrag(float cy);
void setZDrag(float cz);
float getXDrag();
// zero-alpha Z drag ("camber") specified as a fraction of cz
void setBaseZDrag(float cz0);
// i: 0 == forward, 1 == backwards
void setStallPeak(int i, float peak);
// i: 0 == fwd/+z, 1 == fwd/-z, 2 == rev/+z, 3 == rev/-z
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:
float stallFunc(float* v);
float flapLift(float alpha);
float controlDrag(float lift, float drag);
float _chord; // X-axis size
float _c0; // total force coefficient
float _cx; // X-axis force coefficient
float _cy; // Y-axis force coefficient
float _cz; // Z-axis force coefficient
float _cz0; // Z-axis force offset
float _peaks[2]; // Stall peak coefficients (fwd, back)
float _stalls[4]; // Stall angles (fwd/back, pos/neg)
float _widths[4]; // Stall widths " "
float _pos[3]; // position in local coords
float _orient[9]; // local->surface orthonormal matrix
float _slatAlpha;
float _slatDrag;
float _flapLift;
float _flapDrag;
float _flapEffectiveness;
float _spoilerLift;
float _spoilerDrag;
float _slatPos;
float _flapPos;
float _spoilerPos;
float _incidence;
float _twist;
float _inducedDrag;
Version * _version;
};
}; // namespace yasim
#endif // _SURFACE_HPP