FGTrim Class Reference

#include <FGTrim.h>

Inherits FGJSBBase.

List of all members.


Detailed Description

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:

The remaining modes include tCustom, which is completely user defined and tNone.

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:

    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.Report();

Author:
Tony Peden
Version:
"$Id: FGTrim.h,v 1.6 2009/02/05 10:22:49 jberndt Exp $"

Definition at line 130 of file FGTrim.h.


Public Member Functions

bool AddState (State state, Control control)
 Add a state-control pair to the current configuration.
void ClearDebug (void)
void ClearStates (void)
 Clear all state-control pairs from the current configuration.
void DebugState (State state)
 Output debug data for one of the axes The State enum is defined in FGTrimAxis.h.
bool DoTrim (void)
 Execute the trim.
bool EditState (State state, Control new_control)
 Change the control used to zero a state previously configured.
 FGTrim (FGFDMExec *FDMExec, TrimMode tm=tGround)
 Initializes the trimming class.
bool GetGammaFallback (void)
 query the fallback state
double GetTargetNlf (void)
bool RemoveState (State state)
 Remove a specific state-control pair from the current configuration.
void Report (void)
 Print the results of the trim.
void SetDebug (int level)
 Debug level 1 shows results of each top-level iteration Debug level 2 shows level 1 & results of each per-axis iteration.
void SetGammaFallback (bool bb)
 automatically switch to trimming longitudinal acceleration with flight path angle (gamma) once it becomes apparent that there is not enough/too much thrust.
void SetMaxCycles (int ii)
 Set the iteration limit.
void SetMaxCyclesPerAxis (int ii)
 Set the per-axis iteration limit.
void SetMode (TrimMode tm)
 Clear all state-control pairs and set a predefined trim mode.
void SetTargetNlf (double nlf)
void SetTolerance (double tt)
 Set the tolerance for declaring a state trimmed.
void TrimStats ()
 Iteration statistics.

Constructor & Destructor Documentation

FGTrim ( FGFDMExec FDMExec,
TrimMode  tm = tGround 
)

Parameters:
FDMExec pointer to a JSBSim executive object.
tm trim mode

Definition at line 67 of file FGTrim.cpp.


Member Function Documentation

bool AddState ( State  state,
Control  control 
)

See the enums State and Control in FGTrimAxis.h for the available options. Will fail if the given state is already configured.

Parameters:
state the accel or other condition to zero
control the control used to zero the state
Returns:
true if add is successful

Definition at line 151 of file FGTrim.cpp.

void ClearStates ( void   ) 

The trimming routine must have at least one state-control pair configured to be useful

Definition at line 134 of file FGTrim.cpp.

bool EditState ( State  state,
Control  new_control 
)

Parameters:
state the accel or other condition to zero
new_control the control used to zero the state

Definition at line 206 of file FGTrim.cpp.

bool GetGammaFallback ( void   )  [inline]

Returns:
true if fallback is enabled.

Definition at line 249 of file FGTrim.h.

bool RemoveState ( State  state  ) 

Parameters:
state the state to remove
Returns:
true if removal is successful

Definition at line 177 of file FGTrim.cpp.

void Report ( void   ) 

For each axis trimmed, this includes the final state value, control value, and tolerance used.

Returns:
true if trim succeeds

Definition at line 125 of file FGTrim.cpp.

void SetGammaFallback ( bool  bb  )  [inline]

Parameters:
bb true to enable fallback

Definition at line 244 of file FGTrim.h.

void SetMaxCycles ( int  ii  )  [inline]

DoTrim() will return false if limit iterations are reached before trim is achieved. The default is 60. This does not ordinarily need to be changed.

Parameters:
ii integer iteration limit

Definition at line 256 of file FGTrim.h.

void SetMaxCyclesPerAxis ( int  ii  )  [inline]

Attempt to zero each state by iterating limit times before moving on to the next. The default limit is 100 and also does not ordinarily need to be changed.

Parameters:
ii integer iteration limit

Definition at line 264 of file FGTrim.h.

void SetMode ( TrimMode  tm  ) 

Parameters:
tm the set of axes to trim. Can be: tLongitudinal, tFull, tGround, tCustom, or tNone

Definition at line 621 of file FGTrim.cpp.

void SetTolerance ( double  tt  )  [inline]

Angular accels are held to a tolerance of 1/10th of the given. The default is 0.001 for the recti-linear accelerations and 0.0001 for the angular.

Definition at line 270 of file FGTrim.h.


The documentation for this class was generated from the following files:

Generated on Tue May 26 00:55:13 2009 for JSBSim Flight Dynamics Model by  doxygen 1.5.5