]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/initialization/FGTrimAxis.cpp
Merge branch 'jmt/units-fix' into maint
[flightgear.git] / src / FDM / JSBSim / initialization / FGTrimAxis.cpp
index c7b692a3775df2cfed913a002682b13cb56e12f8..186b9b1df354abf8c67fc3472a486f2735f62628 100644 (file)
@@ -7,20 +7,20 @@
  --------- Copyright (C) 1999  Anthony K. Peden (apeden@earthlink.net) ---------
 
  This program is free software; you can redistribute it and/or modify it under
- the terms of the GNU General Public License as published by the Free Software
+ the terms of the GNU Lesser General Public License as published by the Free Software
  Foundation; either version 2 of the License, or (at your option) any later
  version.
 
  This program is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
  details.
 
- You should have received a copy of the GNU General Public License along with
+ You should have received a copy of the GNU Lesser General Public License along with
  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  Place - Suite 330, Boston, MA  02111-1307, USA.
 
- Further information about the GNU General Public License can also be found on
+ Further information about the GNU Lesser General Public License can also be found on
  the world wide web at http://www.gnu.org.
 
 
@@ -37,16 +37,21 @@ INCLUDES
 #endif
 
 #include <string>
-#include <stdlib.h>
-
-#include <FGFDMExec.h>
-#include <models/FGAtmosphere.h>
+#include <cstdlib>
+#include <iomanip>
+#include "FGFDMExec.h"
+#include "models/FGAtmosphere.h"
 #include "FGInitialCondition.h"
 #include "FGTrimAxis.h"
-#include <models/FGAircraft.h>
-#include <models/FGPropulsion.h>
-#include <models/FGAerodynamics.h>
+#include "models/FGAircraft.h"
+#include "models/FGPropulsion.h"
+#include "models/FGAerodynamics.h"
+#include "models/FGFCS.h"
+#include "models/propulsion/FGEngine.h"
+#include "models/FGAuxiliary.h"
+#include "models/FGGroundReactions.h"
 
+using namespace std;
 
 namespace JSBSim {
 
@@ -181,8 +186,8 @@ void FGTrimAxis::getState(void) {
 void FGTrimAxis::getControl(void) {
   switch(control) {
   case tThrottle:  control_value=fdmex->GetFCS()->GetThrottleCmd(0); break;
-  case tBeta:      control_value=fdmex->GetAuxiliary()->Getalpha(); break;
-  case tAlpha:     control_value=fdmex->GetAuxiliary()->Getbeta();  break;
+  case tBeta:      control_value=fdmex->GetAuxiliary()->Getbeta(); break;
+  case tAlpha:     control_value=fdmex->GetAuxiliary()->Getalpha();  break;
   case tPitchTrim: control_value=fdmex->GetFCS() -> GetPitchTrimCmd(); break;
   case tElevator:  control_value=fdmex->GetFCS() -> GetDeCmd(); break;
   case tRollTrim:
@@ -429,13 +434,11 @@ void FGTrimAxis::setThrottlesPct(void) {
 /*****************************************************************************/
 
 void FGTrimAxis::AxisReport(void) {
-
-  char out[80];
-
-  sprintf(out,"  %20s: %6.2f %5s: %9.2e Tolerance: %3.0e",
-           GetControlName().c_str(), GetControl()*control_convert,
-           GetStateName().c_str(), GetState()+state_target, GetTolerance());
-  cout << out;
+  cout << "  " << setw(20) << GetControlName() << ": ";
+  cout << setw(6) << setprecision(2) << GetControl()*control_convert << ' ';
+  cout << setw(5) << GetStateName() << ": ";
+  cout << setw(9) << setprecision(2) << scientific << GetState()+state_target;
+  cout << " Tolerance: " << setw(3) << setprecision(0) << scientific << GetTolerance();
 
   if( fabs(GetState()+state_target) < fabs(GetTolerance()) )
      cout << "  Passed" << endl;