YASim bufix segfault with helicopters.
This commit is contained in:
parent
35f6811ce3
commit
222361bf66
2 changed files with 18 additions and 10 deletions
|
@ -1031,9 +1031,12 @@ void Airplane::solveHelicopter()
|
||||||
|
|
||||||
float Airplane::getCGMAC()
|
float Airplane::getCGMAC()
|
||||||
{
|
{
|
||||||
|
if (_wing) {
|
||||||
float cg[3];
|
float cg[3];
|
||||||
_model.getBody()->getCG(cg);
|
_model.getBody()->getCG(cg);
|
||||||
return (_wing->getMACx() - cg[0]) / _wing->getMAC();
|
return (_wing->getMACx() - cg[0]) / _wing->getMAC();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace yasim
|
}; // namespace yasim
|
||||||
|
|
|
@ -245,10 +245,13 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
float SI_inertia[9];
|
float SI_inertia[9];
|
||||||
a->getModel()->getBody()->getInertiaMatrix(SI_inertia);
|
a->getModel()->getBody()->getInertiaMatrix(SI_inertia);
|
||||||
float MAC = a->getWing()->getMAC();
|
float MAC = 0, MACx = 0, MACy = 0;
|
||||||
float MACx = a->getWing()->getMACx();
|
Wing* wing = a->getWing();
|
||||||
float MACy = a->getWing()->getMACy();
|
if (wing) {
|
||||||
|
MAC = a->getWing()->getMAC();
|
||||||
|
MACx = a->getWing()->getMACx();
|
||||||
|
MACy = a->getWing()->getMACy();
|
||||||
|
}
|
||||||
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());
|
||||||
|
@ -256,9 +259,11 @@ int main(int argc, char** argv)
|
||||||
printf(" Tail Incidence: %.2f deg\n", tail);
|
printf(" Tail Incidence: %.2f deg\n", tail);
|
||||||
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) {
|
||||||
printf(" Wing MAC (*1): x:%.2f, y:%.2f, length:%.1f \n", MACx, MACy, MAC);
|
printf(" Wing MAC (*1): x:%.2f, y:%.2f, length:%.1f \n", MACx, MACy, MAC);
|
||||||
printf(" CG-x rel. MAC: %.3f\n", a->getCGMAC());
|
printf(" CG-x rel. MAC: %.3f\n", a->getCGMAC());
|
||||||
printf(" CG-x desired: %.3f < %.3f < %.3f \n", a->getCGSoftLimitXMin(), cg[0], a->getCGSoftLimitXMax());
|
printf(" CG-x desired: %.3f < %.3f < %.3f \n", a->getCGSoftLimitXMin(), cg[0], a->getCGSoftLimitXMax());
|
||||||
|
}
|
||||||
|
|
||||||
printf("\nInertia tensor [kg*m^2], origo at CG:\n\n");
|
printf("\nInertia tensor [kg*m^2], origo at CG:\n\n");
|
||||||
printf(" %7.3f, %7.3f, %7.3f\n", SI_inertia[0], SI_inertia[1], SI_inertia[2]);
|
printf(" %7.3f, %7.3f, %7.3f\n", SI_inertia[0], SI_inertia[1], SI_inertia[2]);
|
||||||
|
|
Loading…
Reference in a new issue