YASim: bugfix for wing section (wrong surface positions).
Reformated and extended output of CLI tool.
This commit is contained in:
parent
ccfb0d78ae
commit
21aef4da70
4 changed files with 59 additions and 31 deletions
|
@ -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]);
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -253,48 +253,50 @@ int main(int argc, char** argv)
|
||||||
wing = a->getWing();
|
wing = a->getWing();
|
||||||
tail = a->getTail();
|
tail = a->getTail();
|
||||||
}
|
}
|
||||||
printf(" Iterations: %d\n", a->getSolutionIterations());
|
printf("Iterations : %d\n", a->getSolutionIterations());
|
||||||
printf(" Drag Coefficient: %.3f\n", drag);
|
printf("Drag Coefficient : %.3f\n", drag);
|
||||||
printf(" Lift Ratio: %.3f\n", a->getLiftRatio());
|
printf("Lift Ratio : %.3f\n", a->getLiftRatio());
|
||||||
printf(" Cruise AoA: %.2f deg\n", aoa);
|
printf("Cruise AoA : %.2f deg\n", aoa);
|
||||||
printf(" Tail Incidence: %.2f deg\n", tailIncidence);
|
printf("Tail Incidence : %.2f deg\n", tailIncidence);
|
||||||
printf("Approach Elevator: %.3f\n\n", a->getApproachElevator());
|
printf("Approach Elevator : %.3f\n\n", a->getApproachElevator());
|
||||||
printf(" CG: x:%.3f, y:%.3f, z:%.3f\n", cg[0], cg[1], cg[2]);
|
printf("CG : x:%.3f, y:%.3f, z:%.3f\n", cg[0], cg[1], cg[2]);
|
||||||
if (wing) {
|
if (wing) {
|
||||||
MAC = wing->getMACLength();
|
MAC = wing->getMACLength();
|
||||||
MACx = wing->getMACx();
|
MACx = wing->getMACx();
|
||||||
MACy = wing->getMACy();
|
MACy = wing->getMACy();
|
||||||
sweepMin = wing->getSweepLEMin() * RAD2DEG;
|
sweepMin = wing->getSweepLEMin() * RAD2DEG;
|
||||||
sweepMax = wing->getSweepLEMax() * RAD2DEG;
|
sweepMax = wing->getSweepLEMax() * RAD2DEG;
|
||||||
printf(" Wing MAC: (x:%.2f, y:%.2f), length:%.1f \n", MACx, MACy, MAC);
|
printf("Wing MAC : (x:%.2f, y:%.2f), length:%.1f \n", MACx, MACy, MAC);
|
||||||
printf(" hard limit CG-x: %.3f m\n", a->getCGHardLimitXMax());
|
printf("hard limit CG-x : %.3f m\n", a->getCGHardLimitXMax());
|
||||||
printf(" soft limit CG-x: %.3f m\n", a->getCGSoftLimitXMax());
|
printf("soft limit CG-x : %.3f m\n", a->getCGSoftLimitXMax());
|
||||||
printf(" CG-x: %.3f m\n", cg[0]);
|
printf("CG-x : %.3f m\n", cg[0]);
|
||||||
printf(" CG-x rel. MAC: %3.0f%%\n", a->getCGMAC()*100);
|
printf("CG-x rel. MAC : %3.0f%%\n", a->getCGMAC()*100);
|
||||||
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("wing lever : %.3f m\n", a->getWingLever());
|
||||||
printf(" sweep lead. edge: %.1f .. %.1f deg\n", sweepMin, sweepMax);
|
printf("tail lever : %.3f m\n", a->getTailLever());
|
||||||
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("\n");
|
||||||
printf(" tail span: %.3f m\n", tail->getSpan());
|
printf("max thrust : %.2f kN\n", a->getMaxThrust()/1000);
|
||||||
printf(" tail area: %.3f m²\n", tail->getArea());
|
printf("thrust/empty : %.2f\n", a->getThrust2WeightEmpty());
|
||||||
|
printf("thrust/mtow : %.2f\n", a->getThrust2WeightMTOW());
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" wing lever: %.3f m\n", a->getWingLever());
|
printf("wing span : %.2f m\n", a->getWingSpan());
|
||||||
printf(" tail lever: %.3f m\n", a->getTailLever());
|
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("\n");
|
||||||
printf(" max thrust: %.2f kN\n", a->getMaxThrust()/1000);
|
printf("tail span : %.3f m\n", tail->getSpan());
|
||||||
printf(" thrust/empty: %.2f\n", a->getThrust2WeightEmpty());
|
printf("tail area : %.3f m^2\n", tail->getArea());
|
||||||
printf(" thrust/mtow: %.2f\n", a->getThrust2WeightMTOW());
|
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]);
|
||||||
printf(" %7.0f, %7.0f, %7.0f\n", SI_inertia[3], SI_inertia[4], SI_inertia[5]);
|
printf(" %7.0f, %7.0f, %7.0f\n", SI_inertia[3], SI_inertia[4], SI_inertia[5]);
|
||||||
printf(" %7.0f, %7.0f, %7.0f\n", SI_inertia[6], SI_inertia[7], SI_inertia[8]);
|
printf(" %7.0f, %7.0f, %7.0f\n", SI_inertia[6], SI_inertia[7], SI_inertia[8]);
|
||||||
}
|
}
|
||||||
delete fdm;
|
delete fdm;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue