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