1
0
Fork 0

YASim: bugfix for wing section (wrong surface positions).

Reformated and extended output of CLI tool.
This commit is contained in:
Henning Stahlke 2017-12-27 22:26:48 +01:00
parent ccfb0d78ae
commit 21aef4da70
4 changed files with 59 additions and 31 deletions

View file

@ -63,7 +63,8 @@ void Surface::setOrientation(const float* o)
{ {
for(int i=0; i<9; i++) _orient[i] = o[i]; for(int i=0; i<9; i++) _orient[i] = o[i];
if (_surfN) { if (_surfN) {
float xaxis[3] {-1,0,0}; // export the chord line (transformed into aircraft coordiantes)
float xaxis[3] {1,0,0};
Math::tmul33(_orient,xaxis, xaxis); Math::tmul33(_orient,xaxis, xaxis);
_surfN->getNode("axis-x", true)->setFloatValue(xaxis[0]); _surfN->getNode("axis-x", true)->setFloatValue(xaxis[0]);
_surfN->getNode("axis-y", true)->setFloatValue(xaxis[1]); _surfN->getNode("axis-y", true)->setFloatValue(xaxis[1]);

View file

@ -332,10 +332,15 @@ void Wing::compile()
nSegs = 8; nSegs = 8;
float segWid = ws->_length * (end - start)/nSegs; float segWid = ws->_length * (end - start)/nSegs;
float base[3];
_chord2float(ws->_rootChord, base);
float tip[3];
_chord2float(ws->_tipChord, tip);
for(int j=0; j<nSegs; j++) { for(int j=0; j<nSegs; j++) {
float frac = start + (j+0.5f) * (end-start)/nSegs; float frac = start + (j+0.5f) * (end-start)/nSegs;
float pos[3]; float pos[3];
interp(_base, _tip, frac, pos); interp(base, tip, frac, pos);
float chord = ws->_rootChord.length * (1 - (1-ws->_taper)*frac); float chord = ws->_rootChord.length * (1 - (1-ws->_taper)*frac);
float weight = chord * segWid; float weight = chord * segWid;
@ -518,15 +523,23 @@ void Wing::writeInfoToProptree()
for (int section=0; section < _sections.size(); section++) { for (int section=0; section < _sections.size(); section++) {
ws = (WingSection*)_sections.get(section); ws = (WingSection*)_sections.get(section);
float mass {0};
for (int surf=0; surf < ws->numSurfaces(); surf++) { for (int surf=0; surf < ws->numSurfaces(); surf++) {
Surface* s = ws->getSurface(surf); Surface* s = ws->getSurface(surf);
float drag = s->getTotalForceCoefficient(); float drag = s->getTotalForceCoefficient();
dragSum += drag; dragSum += drag;
float mass = ws->getSurfaceWeight(surf); mass = ws->getSurfaceWeight(surf);
mass = mass * Math::sqrt(mass); mass = mass * Math::sqrt(mass);
wgt += mass; wgt += mass;
} }
SGPropertyNode_ptr sectN = _wingN->getChild("section",section,1);
sectN->getNode("surface-count", true)->setFloatValue(ws->numSurfaces());
sectN->getNode("weight", true)->setFloatValue(mass);
sectN->getNode("base-x", true)->setFloatValue(ws->_rootChord.x);
sectN->getNode("base-y", true)->setFloatValue(ws->_rootChord.y);
sectN->getNode("base-z", true)->setFloatValue(ws->_rootChord.z);
sectN->getNode("chord", true)->setFloatValue(ws->_rootChord.length);
} }
_wingN->getNode("weight", true)->setFloatValue(wgt); _wingN->getNode("weight", true)->setFloatValue(wgt);
_wingN->getNode("drag", true)->setFloatValue(dragSum); _wingN->getNode("drag", true)->setFloatValue(dragSum);
@ -574,4 +587,15 @@ float Wing::updateModel(Model* model)
return _weight; return _weight;
} }
void Wing::printSectionInfo()
{
WingSection* ws;
printf("#wing sections: %d\n", _sections.size());
for (int section=0; section < _sections.size(); section++) {
ws = (WingSection*)_sections.get(section);
printf("Section %d base point (%.3f, %.3f, %.3f), chord %.3f\n", section,
ws->_rootChord.x, ws->_rootChord.y, ws->_rootChord.z, ws->_rootChord.length);
}
}
}; // namespace yasim }; // namespace yasim

View file

@ -189,6 +189,7 @@ public:
void setPropertyNode(SGPropertyNode_ptr n) { _wingN = n; }; void setPropertyNode(SGPropertyNode_ptr n) { _wingN = n; };
float updateModel(Model* model); float updateModel(Model* model);
void printSectionInfo();
}; };
}; // namespace yasim }; // namespace yasim

View file

@ -274,21 +274,23 @@ int main(int argc, char** argv)
printf("soft limit CG-x : %.3f m\n", a->getCGSoftLimitXMin()); printf("soft limit CG-x : %.3f m\n", a->getCGSoftLimitXMin());
printf("hard limit CG-x : %.3f m\n", a->getCGHardLimitXMin()); printf("hard limit CG-x : %.3f m\n", a->getCGHardLimitXMin());
printf("\n"); printf("\n");
printf(" wing span: %.2f m\n", a->getWingSpan());
printf(" sweep lead. edge: %.1f .. %.1f deg\n", sweepMin, sweepMax);
printf(" wing area: %.2f m²\n", a->getWingArea());
printf(" wing load empty: %.2f kg/m² (Empty %.0f kg)\n", a->getWingLoadEmpty(), a->getEmptyWeight());
printf(" wing load MTOW: %.2f kg/m² (MTOW %.0f kg)\n", a->getWingLoadMTOW(), a->getMTOW());
printf("\n");
printf(" tail span: %.3f m\n", tail->getSpan());
printf(" tail area: %.3f m²\n", tail->getArea());
printf("\n");
printf("wing lever : %.3f m\n", a->getWingLever()); printf("wing lever : %.3f m\n", a->getWingLever());
printf("tail lever : %.3f m\n", a->getTailLever()); printf("tail lever : %.3f m\n", a->getTailLever());
printf("\n"); printf("\n");
printf("max thrust : %.2f kN\n", a->getMaxThrust()/1000); printf("max thrust : %.2f kN\n", a->getMaxThrust()/1000);
printf("thrust/empty : %.2f\n", a->getThrust2WeightEmpty()); printf("thrust/empty : %.2f\n", a->getThrust2WeightEmpty());
printf("thrust/mtow : %.2f\n", a->getThrust2WeightMTOW()); printf("thrust/mtow : %.2f\n", a->getThrust2WeightMTOW());
printf("\n");
printf("wing span : %.2f m\n", a->getWingSpan());
printf("sweep lead. edge : %.1f .. %.1f deg\n", sweepMin, sweepMax);
printf("wing area : %.2f m^2\n", a->getWingArea());
printf("wing load empty : %.2f kg/m^2 (Empty %.0f kg)\n", a->getWingLoadEmpty(), a->getEmptyWeight());
printf("wing load MTOW : %.2f kg/m^2 (MTOW %.0f kg)\n", a->getWingLoadMTOW(), a->getMTOW());
printf("\n");
printf("tail span : %.3f m\n", tail->getSpan());
printf("tail area : %.3f m^2\n", tail->getArea());
printf("\n");
wing->printSectionInfo();
} }
printf("\nInertia tensor [kg*m^2], origo at CG:\n\n"); printf("\nInertia tensor [kg*m^2], origo at CG:\n\n");
printf(" %7.0f, %7.0f, %7.0f\n", SI_inertia[0], SI_inertia[1], SI_inertia[2]); printf(" %7.0f, %7.0f, %7.0f\n", SI_inertia[0], SI_inertia[1], SI_inertia[2]);