JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
FGTrimAnalysisControl Class Reference

Models an aircraft control variables for purposes of trimming. More...

#include <FGTrimAnalysisControl.h>

+ Inheritance diagram for FGTrimAnalysisControl:
+ Collaboration diagram for FGTrimAnalysisControl:

Public Member Functions

 FGTrimAnalysisControl (FGFDMExec *fdmex, FGInitialCondition *IC, TaControl control)
 Constructor for Trim Analysis Control class. More...
 
 ~FGTrimAnalysisControl ()
 Destructor.
 
double GetControl (void)
 Gets the control value. More...
 
double GetControlInitialValue (void)
 Get control step. More...
 
double GetControlMax (void)
 Gets the control maximum value. More...
 
double GetControlMin (void)
 Gets the control minimum value. More...
 
string GetControlName (void)
 Gets the control name. More...
 
double GetControlStep (void)
 Get control step. More...
 
TaControl GetControlType (void)
 Return the control type. More...
 
double GetStateTarget (void)
 Get target state value for trim. More...
 
double GetTolerance (void)
 Get control tolerance. More...
 
bool initTheta (void)
 Calculate steady state thetas value on ground. More...
 
void Run (void)
 This function iterates through a call to the FGFDMExec::RunIC() function until the desired trimming condition falls inside a tolerance. More...
 
void SetControl (double value)
 Sets the control value. More...
 
void SetControlInitialValue (double value)
 Set control initial value. More...
 
void SetControlLimits (double min, double max)
 Set both control limits. More...
 
void SetControlStep (double value)
 Set control step. More...
 
void SetControlToMax (void)
 Set control value to maximum.
 
void SetControlToMin (void)
 Set control value to minimum.
 
void SetPhiOnGround (double ff)
 Set phi value on ground for trim. More...
 
void SetStateTarget (double target)
 Set target state value for trim. More...
 
void SetThetaOnGround (double ff)
 Set theta value on ground for trim. More...
 
void SetTolerance (double ff)
 Set control tolerance. More...
 
- Public Member Functions inherited from FGJSBBase
 FGJSBBase ()
 Constructor for FGJSBBase.
 
virtual ~FGJSBBase ()
 Destructor for FGJSBBase.
 
void disableHighLighting (void)
 Disables highlighting in the console output.
 
std::string GetVersion (void)
 Returns the version number of JSBSim. More...
 
void PutMessage (const Message &msg)
 Places a Message structure on the Message queue. More...
 
void PutMessage (const std::string &text)
 Creates a message with the given text and places it on the queue. More...
 
void PutMessage (const std::string &text, bool bVal)
 Creates a message with the given text and boolean value and places it on the queue. More...
 
void PutMessage (const std::string &text, int iVal)
 Creates a message with the given text and integer value and places it on the queue. More...
 
void PutMessage (const std::string &text, double dVal)
 Creates a message with the given text and double value and places it on the queue. More...
 
int SomeMessages (void)
 Reads the message on the queue (but does not delete it). More...
 
void ProcessMessage (void)
 Reads the message on the queue and removes it from the queue. More...
 
MessageProcessNextMessage (void)
 Reads the next message on the queue and removes it from the queue. More...
 

Additional Inherited Members

- Public Types inherited from FGJSBBase
enum  { eL = 1, eM, eN }
 Moments L, M, N.
 
enum  { eP = 1, eQ, eR }
 Rates P, Q, R.
 
enum  { eU = 1, eV, eW }
 Velocities U, V, W.
 
enum  { eX = 1, eY, eZ }
 Positions X, Y, Z.
 
enum  { ePhi = 1, eTht, ePsi }
 Euler angles Phi, Theta, Psi.
 
enum  { eDrag = 1, eSide, eLift }
 Stability axis forces, Drag, Side force, Lift.
 
enum  { eRoll = 1, ePitch, eYaw }
 Local frame orientation Roll, Pitch, Yaw.
 
enum  { eNorth = 1, eEast, eDown }
 Local frame position North, East, Down.
 
enum  { eLat = 1, eLong, eRad }
 Locations Radius, Latitude, Longitude.
 
enum  {
  inNone = 0, inDegrees, inRadians, inMeters,
  inFeet
}
 Conversion specifiers.
 
- Static Public Member Functions inherited from FGJSBBase
static double CelsiusToFahrenheit (double celsius)
 Converts from degrees Celsius to degrees Fahrenheit. More...
 
static double CelsiusToKelvin (double celsius)
 Converts from degrees Celsius to degrees Kelvin. More...
 
static double CelsiusToRankine (double celsius)
 Converts from degrees Celsius to degrees Rankine. More...
 
static double Constrain (double min, double value, double max)
 Constrain a value between a minimum and a maximum value.
 
static bool EqualToRoundoff (double a, double b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (float a, float b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (float a, double b)
 Finite precision comparison. More...
 
static bool EqualToRoundoff (double a, float b)
 Finite precision comparison. More...
 
static double FahrenheitToCelsius (double fahrenheit)
 Converts from degrees Fahrenheit to degrees Celsius. More...
 
static double FeetToMeters (double measure)
 Converts from feet to meters. More...
 
static double GaussianRandomNumber (void)
 
static double KelvinToCelsius (double kelvin)
 Converts from degrees Kelvin to degrees Celsius. More...
 
static double KelvinToFahrenheit (double kelvin)
 Converts from degrees Kelvin to degrees Fahrenheit. More...
 
static double KelvinToRankine (double kelvin)
 Converts from degrees Kelvin to degrees Rankine. More...
 
static double MachFromVcalibrated (double vcas, double p, double psl, double rhosl)
 Calculate the Mach number from the calibrated airspeed. More...
 
static double PitotTotalPressure (double mach, double p)
 Compute the total pressure in front of the Pitot tube. More...
 
static double RankineToCelsius (double rankine)
 Converts from degrees Rankine to degrees Celsius. More...
 
static double RankineToKelvin (double rankine)
 Converts from degrees Rankine to degrees Kelvin. More...
 
static double sign (double num)
 
static double VcalibratedFromMach (double mach, double p, double psl, double rhosl)
 Calculate the calibrated airspeed from the Mach number. More...
 
- Static Public Attributes inherited from FGJSBBase
static short debug_lvl = 1
 
static char highint [5] = {27, '[', '1', 'm', '\0' }
 highlights text
 
static char halfint [5] = {27, '[', '2', 'm', '\0' }
 low intensity text
 
static char normint [6] = {27, '[', '2', '2', 'm', '\0' }
 normal intensity text
 
static char reset [5] = {27, '[', '0', 'm', '\0' }
 resets text properties
 
static char underon [5] = {27, '[', '4', 'm', '\0' }
 underlines text
 
static char underoff [6] = {27, '[', '2', '4', 'm', '\0' }
 underline off
 
static char fgblue [6] = {27, '[', '3', '4', 'm', '\0' }
 blue text
 
static char fgcyan [6] = {27, '[', '3', '6', 'm', '\0' }
 cyan text
 
static char fgred [6] = {27, '[', '3', '1', 'm', '\0' }
 red text
 
static char fggreen [6] = {27, '[', '3', '2', 'm', '\0' }
 green text
 
static char fgdef [6] = {27, '[', '3', '9', 'm', '\0' }
 default text
 
- Protected Member Functions inherited from FGJSBBase
void Debug (int)
 
- Static Protected Member Functions inherited from FGJSBBase
static std::string CreateIndexedPropertyName (const std::string &Property, int index)
 
- Static Protected Attributes inherited from FGJSBBase
static const double degtorad = 0.017453292519943295769236907684886
 
static const double fpstokts = 1.0/ktstofps
 
static const double fttom = 0.3048
 
static int gaussian_random_number_phase = 0
 
static const double hptoftlbssec = 550.0
 
static const double in3tom3 = 1.638706E-5
 
static const double inchtoft = 0.08333333
 
static const double inhgtopa = 3386.38
 
static const std::string JSBSim_version = "1.0 " __DATE__ " " __TIME__
 
static const double kgtolb = 2.20462
 
static const double kgtoslug = 0.06852168
 
static const double ktstofps = 1.68781
 
static const double lbtoslug = 1.0/slugtolb
 
static Message localMsg
 
static const double m3toft3 = 1.0/(fttom*fttom*fttom)
 
static double Mair = 28.9645
 
static unsigned int messageId = 0
 
static std::queue< MessageMessages
 
static const std::string needed_cfg_version = "2.0"
 
static const double psftoinhg = 0.014138
 
static const double psftopa = 47.88
 
static const double radtodeg = 57.295779513082320876798154814105
 
static double Reng = 1716.56
 
static double Rstar = 1545.348
 
static const double SHRatio = 1.40
 
static const double slugtolb = 32.174049
 

Detailed Description

Models an aircraft control variables for purposes of trimming.

Definition at line 93 of file FGTrimAnalysisControl.h.

Constructor & Destructor Documentation

◆ FGTrimAnalysisControl()

FGTrimAnalysisControl ( FGFDMExec fdmex,
FGInitialCondition IC,
TaControl  control 
)

Constructor for Trim Analysis Control class.

Parameters
fdmexFGFDMExec pointer
ICpointer to initial conditions instance
controla Control type (enum)

Definition at line 62 of file FGTrimAnalysisControl.cpp.

64  {
65  fdmex=fdex;
66  fgic=ic;
67  state=taAll;
68  control=ctrl;
69  control_initial_value = 0.;
70  control_value=0;
71  state_convert=1.0;
72  control_convert=1.0;
73  state_value=0;
74  state_target=0;
75  control_tolerance = DEFAULT_TOLERANCE;
76 
77  switch(control) {
78  case taThrottle:
79  control_min=0;
80  control_max=1;
81  control_step=0.2;
82  control_initial_value = 0.5;
83  control_value=control_initial_value;
84  control_name = "Throttle (cmd,norm)";
85  break;
86  case taBeta:
87  control_min=-30*degtorad;
88  control_max=30*degtorad;
89  control_step=1*degtorad;
90  control_convert=radtodeg;
91  break;
92  case taAlpha:
93  control_min=fdmex->GetAerodynamics()->GetAlphaCLMin();
94  control_max=fdmex->GetAerodynamics()->GetAlphaCLMax();
95  if(control_max <= control_min) {
96  control_max=20*degtorad;
97  control_min=-5*degtorad;
98  }
99  control_step=1*degtorad;
100  control_initial_value = (control_min+control_max)/2;
101  control_value= control_initial_value;
102  control_convert=radtodeg;
103  break;
104  case taPitchTrim:
105  control_name = "Pitch Trim (cmd,norm)";
106  control_min=-1;
107  control_max=1;
108  control_step=0.1;
109  state_convert=radtodeg;
110  break;
111  case taElevator:
112  control_name = "Elevator (cmd,norm)";
113  control_min=-1;
114  control_max=1;
115  control_step=0.1;
116  state_convert=radtodeg;
117  break;
118  case taRollTrim:
119  control_name = "Roll Trim (cmd,norm)";
120  control_min=-1;
121  control_max=1;
122  control_step=0.1;
123  state_convert=radtodeg;
124  break;
125  case taAileron:
126  control_name = "Ailerons (cmd,norm)";
127  control_min=-1;
128  control_max=1;
129  control_step=0.1;
130  state_convert=radtodeg;
131  break;
132  case taYawTrim:
133  control_name = "Yaw Trim (cmd,norm)";
134  control_min=-1;
135  control_max=1;
136  control_step=0.1;
137  state_convert=radtodeg;
138  break;
139  case taRudder:
140  control_name = "Rudder (cmd,norm)";
141  control_min=-1;
142  control_max=1;
143  control_step=0.1;
144  state_convert=radtodeg;
145  break;
146  case taAltAGL:
147  control_name = "Altitude (ft)";
148  control_min=0;
149  control_max=30;
150  control_step=2;
151  control_initial_value = fdmex->GetPropagate()->GetDistanceAGL();
152  control_value = control_initial_value;
153  break;
154  case taPhi:
155  control_name = "Phi (rad)";
156  control_min=fdmex->GetPropagate()->GetEuler(ePhi) - 30*degtorad;
157  control_max=fdmex->GetPropagate()->GetEuler(ePhi) + 30*degtorad;
158  control_step=1*degtorad;
159  state_convert=radtodeg;
160  control_convert=radtodeg;
161  break;
162  case taTheta:
163  control_name = "Theta (rad)";
164  control_min=fdmex->GetPropagate()->GetEuler(eTht) - 5*degtorad;
165  control_max=fdmex->GetPropagate()->GetEuler(eTht) + 5*degtorad;
166  control_step=1*degtorad;
167  state_convert=radtodeg;
168  break;
169  case taHeading:
170  control_name = "Heading (rad)";
171  control_min=fdmex->GetPropagate()->GetEuler(ePsi) - 30*degtorad;
172  control_max=fdmex->GetPropagate()->GetEuler(ePsi) + 30*degtorad;
173  control_step=1*degtorad;
174  state_convert=radtodeg;
175  break;
176  case taGamma:
177  control_name = "Gamma (rad)";
178  control_min=-80*degtorad;
179  control_max=80*degtorad;
180  control_step=1*degtorad;
181  control_convert=radtodeg;
182  break;
183  }
184 
185 // if (debug_lvl > 0)
186 // cout << "FGTrimAnalysisControl created: "<< control_name << endl;
187 
188  Debug(0);
189 }
const FGColumnVector3 & GetEuler(void) const
Retrieves the Euler angles that define the vehicle orientation.
Definition: FGPropagate.h:260
FGAerodynamics * GetAerodynamics(void)
Returns the FGAerodynamics pointer.
Definition: FGFDMExec.h:357
FGPropagate * GetPropagate(void)
Returns the FGPropagate pointer.
Definition: FGFDMExec.h:369
+ Here is the call graph for this function:

Member Function Documentation

◆ GetControl()

double GetControl ( void  )
inline

Gets the control value.

Returns
value

Definition at line 122 of file FGTrimAnalysisControl.h.

122 { return control_value; }

◆ GetControlInitialValue()

double GetControlInitialValue ( void  )
inline

Get control step.

Returns
value of control initial value

Definition at line 163 of file FGTrimAnalysisControl.h.

163 { return control_initial_value; }

◆ GetControlMax()

double GetControlMax ( void  )
inline

Gets the control maximum value.

Returns
control nax value

Definition at line 144 of file FGTrimAnalysisControl.h.

144 { return control_max; }
+ Here is the caller graph for this function:

◆ GetControlMin()

double GetControlMin ( void  )
inline

Gets the control minimum value.

Returns
control min value

Definition at line 140 of file FGTrimAnalysisControl.h.

140 { return control_min; }
+ Here is the call graph for this function:

◆ GetControlName()

string GetControlName ( void  )
inline

Gets the control name.

Returns
control name

Definition at line 135 of file FGTrimAnalysisControl.h.

135 { return control_name; }

◆ GetControlStep()

double GetControlStep ( void  )
inline

Get control step.

Returns
value of control step

Definition at line 153 of file FGTrimAnalysisControl.h.

153 { return control_step; }

◆ GetControlType()

TaControl GetControlType ( void  )
inline

Return the control type.

Returns
TaControl

Definition at line 128 of file FGTrimAnalysisControl.h.

128 { return control; }
+ Here is the caller graph for this function:

◆ GetStateTarget()

double GetStateTarget ( void  )
inline

Get target state value for trim.

Returns
state target

Definition at line 210 of file FGTrimAnalysisControl.h.

210 { return state_target; }
+ Here is the call graph for this function:

◆ GetTolerance()

double GetTolerance ( void  )
inline

Get control tolerance.

Returns
value of control tolerance

Definition at line 190 of file FGTrimAnalysisControl.h.

190 { return control_tolerance; }
+ Here is the call graph for this function:

◆ initTheta()

bool initTheta ( void  )

Calculate steady state thetas value on ground.

Returns
true if successful

Definition at line 328 of file FGTrimAnalysisControl.cpp.

328  {
329  int i,N;
330  int iForward = 0;
331  int iAft = 1;
332  double zAft,zForward,zDiff,theta;
333  double xAft,xForward,xDiff;
334  bool level;
335  double saveAlt;
336 
337  saveAlt=fgic->GetAltitudeAGLFtIC();
338  fgic->SetAltitudeAGLFtIC(100);
339 
340 
341  N=fdmex->GetGroundReactions()->GetNumGearUnits();
342 
343  //find the first wheel unit forward of the cg
344  //the list is short so a simple linear search is fine
345  for( i=0; i<N; i++ ) {
346  if(fdmex->GetGroundReactions()->GetGearUnit(i)->GetBodyLocation(1) > 0 ) {
347  iForward=i;
348  break;
349  }
350  }
351  //now find the first wheel unit aft of the cg
352  for( i=0; i<N; i++ ) {
353  if(fdmex->GetGroundReactions()->GetGearUnit(i)->GetBodyLocation(1) < 0 ) {
354  iAft=i;
355  break;
356  }
357  }
358 
359  // now adjust theta till the wheels are the same distance from the ground
360  xAft=fdmex->GetGroundReactions()->GetGearUnit(iAft)->GetBodyLocation(1);
361  xForward=fdmex->GetGroundReactions()->GetGearUnit(iForward)->GetBodyLocation(1);
362  xDiff = xForward - xAft;
363  zAft=fdmex->GetGroundReactions()->GetGearUnit(iAft)->GetLocalGear(3);
364  zForward=fdmex->GetGroundReactions()->GetGearUnit(iForward)->GetLocalGear(3);
365  zDiff = zForward - zAft;
366  level=false;
367  theta=fgic->GetThetaDegIC();
368  while(!level && (i < 100)) {
369  theta+=radtodeg*atan(zDiff/xDiff);
370  fgic->SetThetaDegIC(theta);
371  fdmex->SuspendIntegration();
372  fdmex->Initialize(fgic);
373  fdmex->Run();
374  fdmex->ResumeIntegration();
375  zAft=fdmex->GetGroundReactions()->GetGearUnit(iAft)->GetLocalGear(3);
376  zForward=fdmex->GetGroundReactions()->GetGearUnit(iForward)->GetLocalGear(3);
377  zDiff = zForward - zAft;
378  //cout << endl << theta << " " << zDiff << endl;
379  //cout << "0: " << fdmex->GetGroundReactions()->GetGearUnit(0)->GetLocalGear() << endl;
380  //cout << "1: " << fdmex->GetGroundReactions()->GetGearUnit(1)->GetLocalGear() << endl;
381  if(fabs(zDiff ) < 0.1)
382  level=true;
383  i++;
384  }
385  //cout << i << endl;
386  if (debug_lvl > 0) {
387  cout << " Initial Theta: " << fdmex->GetPropagate()->GetEuler(eTht)*radtodeg << endl;
388  cout << " Used gear unit " << iAft << " as aft and " << iForward << " as forward" << endl;
389  }
390  control_min=(theta+5)*degtorad;
391  control_max=(theta-5)*degtorad;
392  fgic->SetAltitudeAGLFtIC(saveAlt);
393  if(i < 100)
394  return true;
395  else
396  return false;
397 }
void SetThetaDegIC(double theta)
Sets pitch angle initial condition in degrees.
double GetThetaDegIC(void) const
Gets the initial pitch angle.
FGColumnVector3 GetBodyLocation(void) const
Gets the location of the gear in Body axes.
Definition: FGLGear.h:245
double GetAltitudeAGLFtIC(void) const
Gets the initial altitude above ground level.
void SuspendIntegration(void)
Suspends the simulation and sets the delta T to zero.
Definition: FGFDMExec.h:539
void Initialize(FGInitialCondition *FGIC)
Initializes the simulation with initial conditions.
Definition: FGFDMExec.cpp:591
FGGroundReactions * GetGroundReactions(void)
Returns the FGGroundReactions pointer.
Definition: FGFDMExec.h:361
const FGColumnVector3 & GetEuler(void) const
Retrieves the Euler angles that define the vehicle orientation.
Definition: FGPropagate.h:260
void SetAltitudeAGLFtIC(double agl)
Sets the initial Altitude above ground level.
void ResumeIntegration(void)
Resumes the simulation by resetting delta T to the correct value.
Definition: FGFDMExec.h:542
FGLGear * GetGearUnit(int gear) const
Gets a gear instance.
bool Run(void)
This function executes each scheduled model in succession.
Definition: FGFDMExec.cpp:310
FGPropagate * GetPropagate(void)
Returns the FGPropagate pointer.
Definition: FGFDMExec.h:369
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Run()

void Run ( void  )

This function iterates through a call to the FGFDMExec::RunIC() function until the desired trimming condition falls inside a tolerance.

Definition at line 430 of file FGTrimAnalysisControl.cpp.

430  {
431 
432  // ... what's going on here ??
433 }
+ Here is the call graph for this function:

◆ SetControl()

void SetControl ( double  value)
inline

Sets the control value.

Parameters
value

Definition at line 117 of file FGTrimAnalysisControl.h.

117 { control_value=value; }

◆ SetControlInitialValue()

void SetControlInitialValue ( double  value)
inline

Set control initial value.

Parameters
valueof control initial value

Definition at line 158 of file FGTrimAnalysisControl.h.

158 { control_initial_value = value; }

◆ SetControlLimits()

void SetControlLimits ( double  min,
double  max 
)
inline

Set both control limits.

Parameters
maxcontrol max
mincontrol min

Definition at line 177 of file FGTrimAnalysisControl.h.

177  {
178  control_min=min;
179  control_max=max;
180  }

◆ SetControlStep()

void SetControlStep ( double  value)
inline

Set control step.

Parameters
valueof control step

Definition at line 149 of file FGTrimAnalysisControl.h.

149 { control_step = value; }

◆ SetPhiOnGround()

void SetPhiOnGround ( double  ff)

Set phi value on ground for trim.

Parameters
ff

Definition at line 401 of file FGTrimAnalysisControl.cpp.

401  {
402  int i,ref;
403 
404  i=0; ref=-1;
405  //must have an off-center unit here
406  while ( (ref < 0) && (i < fdmex->GetGroundReactions()->GetNumGearUnits()) ) {
407  if ( (fdmex->GetGroundReactions()->GetGearUnit(i)->GetWOW()) &&
408  (fabs(fdmex->GetGroundReactions()->GetGearUnit(i)->GetBodyLocation(2)) > 0.01))
409  ref=i;
410  i++;
411  }
412  if (ref >= 0) {
413  double st = fdmex->GetPropagate()->GetSinEuler(eTht);
414  double ct = fdmex->GetPropagate()->GetCosEuler(eTht);
415  double lx = fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1);
416  double ly = fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2);
417  double lz = fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3);
418  double hagl = -1*lx*st +
419  ly*sin(ff)*ct +
420  lz*cos(ff)*ct;
421 
422  fgic->SetAltitudeAGLFtIC(hagl);
423  }
424  fgic->SetPhiRadIC(ff);
425 
426 }
FGColumnVector3 GetBodyLocation(void) const
Gets the location of the gear in Body axes.
Definition: FGLGear.h:245
double GetCosEuler(int idx) const
Retrieves the cosine of a vehicle Euler angle component.
Definition: FGPropagate.h:406
void SetPhiRadIC(double phi)
Sets the initial roll angle.
double GetSinEuler(int idx) const
Retrieves the sine of a vehicle Euler angle component.
Definition: FGPropagate.h:418
FGGroundReactions * GetGroundReactions(void)
Returns the FGGroundReactions pointer.
Definition: FGFDMExec.h:361
void SetAltitudeAGLFtIC(double agl)
Sets the initial Altitude above ground level.
FGLGear * GetGearUnit(int gear) const
Gets a gear instance.
bool GetWOW(void) const
Gets the Weight On Wheels flag value.
Definition: FGLGear.h:259
FGPropagate * GetPropagate(void)
Returns the FGPropagate pointer.
Definition: FGFDMExec.h:369
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetStateTarget()

void SetStateTarget ( double  target)
inline

Set target state value for trim.

Parameters
target

Definition at line 205 of file FGTrimAnalysisControl.h.

205 { state_target=target; }

◆ SetThetaOnGround()

void SetThetaOnGround ( double  ff)

Set theta value on ground for trim.

Parameters
ff

Definition at line 289 of file FGTrimAnalysisControl.cpp.

289  {
290  int center,i,ref;
291 
292  // favor an off-center unit so that the same one can be used for both
293  // pitch and roll. An on-center unit is used (for pitch)if that's all
294  // that's in contact with the ground.
295  i=0; ref=-1; center=-1;
296  while( (ref < 0) && (i < fdmex->GetGroundReactions()->GetNumGearUnits()) ) {
297  if(fdmex->GetGroundReactions()->GetGearUnit(i)->GetWOW()) {
298  if(fabs(fdmex->GetGroundReactions()->GetGearUnit(i)->GetBodyLocation(2)) > 0.01)
299  ref=i;
300  else
301  center=i;
302  }
303  i++;
304  }
305  if((ref < 0) && (center >= 0)) {
306  ref=center;
307  }
308  cout << "SetThetaOnGround ref gear: " << ref << endl;
309  if(ref >= 0) {
310  double sp = fdmex->GetPropagate()->GetSinEuler(ePhi);
311  double cp = fdmex->GetPropagate()->GetCosEuler(ePhi);
312  double lx = fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(1);
313  double ly = fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(2);
314  double lz = fdmex->GetGroundReactions()->GetGearUnit(ref)->GetBodyLocation(3);
315  double hagl = -1*lx*sin(ff) +
316  ly*sp*cos(ff) +
317  lz*cp*cos(ff);
318 
319  fgic->SetAltitudeAGLFtIC(hagl);
320  cout << "SetThetaOnGround new alt: " << hagl << endl;
321  }
322  fgic->SetThetaRadIC(ff);
323  cout << "SetThetaOnGround new theta: " << ff << endl;
324 }
void SetThetaRadIC(double theta)
Sets the initial pitch angle.
FGColumnVector3 GetBodyLocation(void) const
Gets the location of the gear in Body axes.
Definition: FGLGear.h:245
double GetCosEuler(int idx) const
Retrieves the cosine of a vehicle Euler angle component.
Definition: FGPropagate.h:406
double GetSinEuler(int idx) const
Retrieves the sine of a vehicle Euler angle component.
Definition: FGPropagate.h:418
FGGroundReactions * GetGroundReactions(void)
Returns the FGGroundReactions pointer.
Definition: FGFDMExec.h:361
void SetAltitudeAGLFtIC(double agl)
Sets the initial Altitude above ground level.
FGLGear * GetGearUnit(int gear) const
Gets a gear instance.
bool GetWOW(void) const
Gets the Weight On Wheels flag value.
Definition: FGLGear.h:259
FGPropagate * GetPropagate(void)
Returns the FGPropagate pointer.
Definition: FGFDMExec.h:369
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTolerance()

void SetTolerance ( double  ff)
inline

Set control tolerance.

Parameters
ffvalue of control tolerance

Definition at line 185 of file FGTrimAnalysisControl.h.

185 { control_tolerance=ff;}

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