+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** FGTrim -- the trimming routine for JSBSim.
+ FGTrim finds the aircraft attitude and control settings needed to maintain
+ the steady state described by the FGInitialCondition object . It does this
+ iteratively by assigning a control to each state and adjusting that control
+ until the state is within a specified tolerance of zero. States include the
+ recti-linear accelerations udot, vdot, and wdot, the angular accelerations
+ qdot, pdot, and rdot, and the difference between heading and ground track.
+ Controls include the usual flight deck controls available to the pilot plus
+ angle of attack (alpha), sideslip angle(beta), flight path angle (gamma),
+ pitch attitude(theta), roll attitude(phi), and altitude above ground. The
+ last three are used for on-ground trimming. The state-control pairs used in
+ a given trim are completely user configurable and several pre-defined modes
+ are provided as well. They are:
+ - tLongitudinal: Trim wdot with alpha, udot with thrust, qdot with elevator
+ - tFull: tLongitudinal + vdot with phi, pdot with aileron, rdot with rudder
+ and heading minus ground track (hmgt) with beta
+ - tPullup: tLongitudinal but adjust alpha to achieve load factor input
+ with SetTargetNlf()
+ - tGround: wdot with altitude, qdot with theta, and pdot with phi
+
+ The remaining modes include <b>tCustom</b>, which is completely user defined and
+ <b>tNone</b>.
+
+ Note that trims can (and do) fail for reasons that are completely outside
+ the control of the trimming routine itself. The most common problem is the
+ initial conditions: is the model capable of steady state flight
+ at those conditions? Check the speed, altitude, configuration (flaps,
+ gear, etc.), weight, cg, and anything else that may be relevant.
+
+ Example usage:<pre>
+ FGFDMExec* FDMExec = new FGFDMExec();
+
+ FGInitialCondition* fgic = new FGInitialCondition(FDMExec);
+ FGTrim *fgt(FDMExec,fgic,tFull);
+ fgic->SetVcaibratedKtsIC(100);
+ fgic->SetAltitudeFtIC(1000);
+ fgic->SetClimbRate(500);
+ if( !fgt->DoTrim() ) {
+ cout << "Trim Failed" << endl;
+ }
+ fgt->ReportState(); </pre>
+ @author Tony Peden
+ @version "$Id$"
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+class FGTrim : public FGJSBBase
+{