--------- 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.
#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 {
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:
case tYawTrim:
case tRudder: fdmex->GetFCS()->SetDrCmd(control_value); break;
case tAltAGL: fgic->SetAltitudeAGLFtIC(control_value); break;
- case tTheta: fgic->SetPitchAngleRadIC(control_value); break;
- case tPhi: fgic->SetRollAngleRadIC(control_value); break;
+ case tTheta: fgic->SetThetaRadIC(control_value); break;
+ case tPhi: fgic->SetPhiRadIC(control_value); break;
case tGamma: fgic->SetFlightPathAngleRadIC(control_value); break;
- case tHeading: fgic->SetTrueHeadingRadIC(control_value); break;
+ case tHeading: fgic->SetPsiRadIC(control_value); break;
}
}
fgic->SetAltitudeAGLFtIC(hagl);
cout << "SetThetaOnGround new alt: " << hagl << endl;
}
- fgic->SetPitchAngleRadIC(ff);
+ fgic->SetThetaRadIC(ff);
cout << "SetThetaOnGround new theta: " << ff << endl;
}
zForward=fdmex->GetGroundReactions()->GetGearUnit(iForward)->GetLocalGear(3);
zDiff = zForward - zAft;
level=false;
- theta=fgic->GetPitchAngleDegIC();
+ theta=fgic->GetThetaDegIC();
while(!level && (i < 100)) {
theta+=radtodeg*atan(zDiff/xDiff);
- fgic->SetPitchAngleDegIC(theta);
+ fgic->SetThetaDegIC(theta);
fdmex->RunIC();
zAft=fdmex->GetGroundReactions()->GetGearUnit(iAft)->GetLocalGear(3);
zForward=fdmex->GetGroundReactions()->GetGearUnit(iForward)->GetLocalGear(3);
fgic->SetAltitudeAGLFtIC(hagl);
}
- fgic->SetRollAngleRadIC(ff);
+ fgic->SetPhiRadIC(ff);
}
/*****************************************************************************/
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;