FGColumnVector3 FGMassBalance::StructuralToBody(const FGColumnVector3& r) const { // Under the assumption that in the structural frame the: // // - X-axis is directed afterwards, // - Y-axis is directed towards the right, // - Z-axis is directed upwards, // // (as documented in http://jsbsim.sourceforge.net/JSBSimCoordinates.pdf) // we have to subtract first the center of gravity of the plane which // is also defined in the structural frame: // // FGColumnVector3 cgOff = r - vXYZcg; // // Next, we do a change of units: // // cgOff *= inchtoft; // // And then a 180 degree rotation is done about the Y axis so that the: // // - X-axis is directed forward, // - Y-axis is directed towards the right, // - Z-axis is directed downward. // // This is needed because the structural and body frames are 180 degrees apart. return FGColumnVector3(inchtoft*(vXYZcg(1)-r(1)), inchtoft*(r(2)-vXYZcg(2)), inchtoft*(vXYZcg(3)-r(3))); }
void FGMassBalance::GetMassPropertiesReport(int i) { cout << endl << fgblue << highint << " Mass Properties Report (English units: lbf, in, slug-ft^2)" << reset << endl; cout << " " << underon << " Weight CG-X CG-Y" << " CG-Z Ixx Iyy Izz" << " Ixy Ixz Iyz" << underoff << endl; cout.precision(1); cout << highint << setw(34) << left << " Base Vehicle " << normint << right << setw(10) << EmptyWeight << setw(8) << vbaseXYZcg(eX) << setw(8) << vbaseXYZcg(eY) << setw(8) << vbaseXYZcg(eZ) << setw(12) << baseJ(1,1) << setw(12) << baseJ(2,2) << setw(12) << baseJ(3,3) << setw(12) << baseJ(1,2) << setw(12) << baseJ(1,3) << setw(12) << baseJ(2,3) << endl; for (unsigned int i=0;i<PointMasses.size();i++) { PointMass* pm = PointMasses[i]; double pmweight = pm->GetPointMassWeight(); cout << highint << left << setw(4) << i << setw(30) << pm->GetName() << normint << right << setw(10) << pmweight << setw(8) << pm->GetLocation()(eX) << setw(8) << pm->GetLocation()(eY) << setw(8) << pm->GetLocation()(eZ) << setw(12) << pm->GetPointMassMoI(1,1) << setw(12) << pm->GetPointMassMoI(2,2) << setw(12) << pm->GetPointMassMoI(3,3) << setw(12) << pm->GetPointMassMoI(1,2) << setw(12) << pm->GetPointMassMoI(1,3) << setw(12) << pm->GetPointMassMoI(2,3) << endl; } cout << FDMExec->GetPropulsionTankReport(); cout << " " << underon << setw(136) << " " << underoff << endl; cout << highint << left << setw(30) << " Total: " << right << setw(14) << Weight << setw(8) << vXYZcg(eX) << setw(8) << vXYZcg(eY) << setw(8) << vXYZcg(eZ) << setw(12) << mJ(1,1) << setw(12) << mJ(2,2) << setw(12) << mJ(3,3) << setw(12) << mJ(1,2) << setw(12) << mJ(1,3) << setw(12) << mJ(2,3) << normint << endl; cout.setf(ios_base::fixed); }