YASIM add struct StallParams to Wing
This commit is contained in:
parent
b288ca3d9d
commit
6feca92060
3 changed files with 22 additions and 17 deletions
|
@ -534,10 +534,12 @@ void FGFDM::startElement(const char* name, const XMLAttributes &atts)
|
|||
} else if(eq(name, "weight")) {
|
||||
parseWeight(a);
|
||||
} else if(eq(name, "stall")) {
|
||||
Wing* w = (Wing*)_currObj;
|
||||
w->setStall(attrf(a, "aoa") * DEG2RAD);
|
||||
w->setStallWidth(attrf(a, "width", 2) * DEG2RAD);
|
||||
w->setStallPeak(attrf(a, "peak", 1.5));
|
||||
Wing* w = (Wing*)_currObj;
|
||||
StallParams sp;
|
||||
sp.aoa = attrf(a, "aoa") * DEG2RAD;
|
||||
sp.width = attrf(a, "width", 2) * DEG2RAD;
|
||||
sp.peak = attrf(a, "peak", 1.5);
|
||||
w->setStallParams(sp);
|
||||
} else if(eq(name, "flap0") || eq(name, "flap1") || eq(name, "spoiler") || eq(name, "slat")) {
|
||||
FlapParams fp;
|
||||
fp.start = attrf(a, "start");
|
||||
|
|
|
@ -297,27 +297,27 @@ Surface* Wing::newSurface(float* pos, float* orient, float chord,
|
|||
s->setChord(chord);
|
||||
|
||||
// Camber is expressed as a fraction of stall peak, so convert.
|
||||
s->setBaseZDrag(_camber*_stallPeak);
|
||||
s->setBaseZDrag(_camber*_stallParams.peak);
|
||||
|
||||
// The "main" (i.e. normal) stall angle
|
||||
float stallAoA = _stall - _stallWidth/4;
|
||||
float stallAoA = _stallParams.aoa - _stallParams.width/4;
|
||||
s->setStall(0, stallAoA);
|
||||
s->setStallWidth(0, _stallWidth);
|
||||
s->setStallPeak(0, _stallPeak);
|
||||
s->setStallWidth(0, _stallParams.width);
|
||||
s->setStallPeak(0, _stallParams.peak);
|
||||
|
||||
// The negative AoA stall is the same if we're using an symmetric
|
||||
// airfoil, otherwise a "little worse".
|
||||
if(_camber > 0) {
|
||||
s->setStall(1, stallAoA * 0.8f);
|
||||
s->setStallWidth(1, _stallWidth * 0.5f);
|
||||
s->setStallWidth(1, _stallParams.width * 0.5f);
|
||||
} else {
|
||||
s->setStall(1, stallAoA);
|
||||
if( _version->isVersionOrNewer( Version::YASIM_VERSION_2017_2 )) {
|
||||
// what was presumably meant
|
||||
s->setStallWidth(1, _stallWidth);
|
||||
s->setStallWidth(1, _stallParams.width);
|
||||
} else {
|
||||
// old code; presumably a copy&paste error
|
||||
s->setStall(1, _stallWidth);
|
||||
s->setStall(1, _stallParams.width);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@ struct FlapParams {
|
|||
float aoa {0};
|
||||
};
|
||||
|
||||
struct StallParams {
|
||||
float aoa {0};
|
||||
float width {0};
|
||||
float peak {0};
|
||||
};
|
||||
|
||||
// position and length of a chord line
|
||||
struct Chord {
|
||||
float x {0};
|
||||
|
@ -65,9 +71,7 @@ public:
|
|||
|
||||
|
||||
// parameters for stall curve
|
||||
void setStall(float aoa) { _stall = aoa; }
|
||||
void setStallWidth(float angle) { _stallWidth = angle; }
|
||||
void setStallPeak(float fraction) { _stallPeak = fraction; }
|
||||
void setStallParams(StallParams sp) { _stallParams = sp; }
|
||||
void setCamber(float camber) { _camber = camber; }
|
||||
void setInducedDrag(float drag) { _inducedDrag = drag; }
|
||||
|
||||
|
@ -151,9 +155,8 @@ private:
|
|||
float _wingspan {0};
|
||||
float _aspectRatio {1};
|
||||
|
||||
float _stall {0};
|
||||
float _stallWidth {0};
|
||||
float _stallPeak {0};
|
||||
StallParams _stallParams;
|
||||
|
||||
float _twist {0};
|
||||
float _camber {0};
|
||||
float _incidence {0};
|
||||
|
|
Loading…
Reference in a new issue