JSBSim Flight Dynamics Model 1.3.0 (09 Apr 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGLGear Class Reference

Detailed Description

Landing gear model.

Calculates forces and moments due to landing gear reactions. This is done in several steps, and is dependent on what kind of gear is being modeled. Here are the parameters that can be specified in the config file for modeling landing gear:

Physical Characteristics

  1. X, Y, Z location, in inches in structural coordinate frame
  2. Spring constant, in lbs/ft
  3. Damping coefficient, in lbs/ft/sec
  4. Dynamic Friction Coefficient
  5. Static Friction Coefficient

Operational Properties

  1. Name
  2. Brake Group Membership {one of LEFT | CENTER | RIGHT | NOSE | TAIL | NONE}
  3. Max Steer Angle, in degrees

Algorithm and Approach to Modeling

  1. Find the location of the uncompressed landing gear relative to the CG of the aircraft. Remember, the structural coordinate frame that the aircraft is defined in is: X positive towards the tail, Y positive out the right side, Z positive upwards. The locations of the various parts are given in inches in the config file.
  2. The vector giving the location of the gear (relative to the cg) is rotated 180 degrees about the Y axis to put the coordinates in body frame (X positive forwards, Y positive out the right side, Z positive downwards, with the origin at the cg). The lengths are also now given in feet.
  3. The new gear location is now transformed to the local coordinate frame using the body-to-local matrix. (Mb2l).
  4. Knowing the location of the center of gravity relative to the ground (height above ground level or AGL) now enables gear deflection to be calculated. The gear compression value is the local frame gear Z location value minus the height AGL. [Currently, we make the assumption that the gear is oriented - and the deflection occurs in - the Z axis only. Additionally, the vector to the landing gear is currently not modified - which would (correctly) move the point of contact to the actual compressed-gear point of contact. Eventually, articulated gear may be modeled, but initially an effort must be made to model a generic system.] As an example, say the aircraft left main gear location (in local coordinates) is Z = 3 feet (positive) and the height AGL is 2 feet. This tells us that the gear is compressed 1 foot.
  5. If the gear is compressed, a Weight-On-Wheels (WOW) flag is set.
  6. With the compression length calculated, the compression velocity may now be calculated. This will be used to determine the damping force in the strut. The aircraft rotational rate is multiplied by the vector to the wheel to get a wheel velocity in body frame. That velocity vector is then transformed into the local coordinate frame.
  7. The aircraft cg velocity in the local frame is added to the just-calculated wheel velocity (due to rotation) to get a total wheel velocity in the local frame.
  8. The compression speed is the Z-component of the vector.
  9. With the wheel velocity vector no longer needed, it is normalized and multiplied by a -1 to reverse it. This will be used in the friction force calculation.
  10. Since the friction force takes place solely in the runway plane, the Z coordinate of the normalized wheel velocity vector is set to zero.
  11. The gear deflection force (the force on the aircraft acting along the local frame Z axis) is now calculated given the spring and damper coefficients, and the gear deflection speed and stroke length. Keep in mind that gear forces always act in the negative direction (in both local and body frames), and are not capable of generating a force in the positive sense (one that would attract the aircraft to the ground). So, the gear forces are always negative - they are limited to values of zero or less. The gear force is simply the negative of the sum of the spring compression length times the spring coefficient and the gear velocity times the damping coefficient.
  12. The lateral/directional force acting on the aircraft through the landing

    gear (along the local frame X and Y axes) is calculated next. First, the friction coefficient is multiplied by the recently calculated Z-force. This is the friction force. It must be given direction in addition to magnitude. We want the components in the local frame X and Y axes. From step 9, above, the conditioned wheel velocity vector is taken and the X and Y parts are multiplied by the friction force to get the X and Y components of friction.

  13. The wheel force in local frame is next converted to body frame.
  14. The moment due to the gear force is calculated by multiplying r x F (radius to wheel crossed into the wheel force). Both of these operands are in body frame.

Configuration File Format for <contact> Section:

<contact type="{BOGEY | STRUCTURE}" name="{string}">
<location unit="{IN | M}">
<x> {number} </x>
<y> {number} </y>
<z> {number} </z>
</location>
<orientation unit="{RAD | DEG}">
<pitch> {number} </pitch>
<roll> {number} </roll>
<yaw> {number} </yaw>
</orientation>
<static_friction> {number} </static_friction>
<dynamic_friction> {number} </dynamic_friction>
<rolling_friction> {number} </rolling_friction>
<spring_coeff unit="{LBS/FT | N/M}"> {number} </spring_coeff>
<damping_coeff type="{ | SQUARE}" unit="{LBS/FT/SEC | N/M/SEC}"> {number} </damping_coeff>
<damping_coeff_rebound type="{ | SQUARE}" unit="{LBS/FT/SEC | N/M/SEC}"> {number} </damping_coeff_rebound>
<max_steer unit="DEG"> {number | 0 | 360} </max_steer>
<brake_group> {NONE | LEFT | RIGHT | CENTER | NOSE | TAIL} </brake_group>
<retractable>{0 | 1}</retractable>
<table name="{CORNERING_COEFF}" type="internal">
<tableData>
{cornering parameters}
</tableData>
</table>
</contact>
Author
Jon S. Berndt
See also
Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at NASA-Ames", NASA CR-2497, January 1975
Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics", Wiley & Sons, 1979 ISBN 0-471-03032-5
W. A. Ragsdale, "A Generic Landing Gear Dynamics Model for LASRS++", AIAA-2000-4303

Definition at line 191 of file FGLGear.h.

#include <FGLGear.h>

+ Inheritance diagram for FGLGear:
+ Collaboration diagram for FGLGear:

Classes

struct  Inputs
 

Public Types

enum  BrakeGroup {
  bgNone =0 , bgLeft , bgRight , bgCenter ,
  bgNose , bgTail , bgNumBrakeGroups
}
 Brake grouping enumerators. More...
 
enum  ContactType { ctBOGEY , ctSTRUCTURE }
 Contact point type. More...
 
enum  DampType { dtLinear =0 , dtSquare }
 Damping types. More...
 
enum  FrictionType { ftRoll =0 , ftSide , ftDynamic }
 Friction types. More...
 
enum  ReportType { erNone =0 , erTakeoff , erLand }
 Report type enumerators. More...
 
enum  SteerType { stSteer , stFixed , stCaster }
 Steering group membership enumerators. More...
 
- Public Types inherited from FGForce
enum  TransformType {
  tNone , tWindBody , tLocalBody , tInertialBody ,
  tCustom
}
 
- Public Types inherited from FGJSBBase
enum  { eL = 1 , eM , eN }
 Moments L, M, N. More...
 
enum  { eP = 1 , eQ , eR }
 Rates P, Q, R. More...
 
enum  { eU = 1 , eV , eW }
 Velocities U, V, W. More...
 
enum  { eX = 1 , eY , eZ }
 Positions X, Y, Z. More...
 
enum  { ePhi = 1 , eTht , ePsi }
 Euler angles Phi, Theta, Psi. More...
 
enum  { eDrag = 1 , eSide , eLift }
 Stability axis forces, Drag, Side force, Lift. More...
 
enum  { eRoll = 1 , ePitch , eYaw }
 Local frame orientation Roll, Pitch, Yaw. More...
 
enum  { eNorth = 1 , eEast , eDown }
 Local frame position North, East, Down. More...
 
enum  { eLat = 1 , eLong , eRad }
 Locations Radius, Latitude, Longitude. More...
 
enum  {
  inNone = 0 , inDegrees , inRadians , inMeters ,
  inFeet
}
 Conversion specifiers. More...
 

Public Member Functions

 FGLGear (Element *el, FGFDMExec *Executive, int number, const struct Inputs &input)
 Constructor.
 
 ~FGLGear ()
 Destructor.
 
const FGColumnVector3GetBodyForces (void) override
 The Force vector for this gear.
 
double GetBodyLocation (int idx) const
 
FGColumnVector3 GetBodyLocation (void) const
 Gets the location of the gear in Body axes.
 
double GetBodyXForce (void)
 
double GetBodyYForce (void)
 
double GetBodyZForce (void)
 
int GetBrakeGroup (void) const
 
double GetCompForce (void) const
 Gets the gear compression force in pounds.
 
double GetCompLen (void) const
 Gets the current compressed length of the gear in feet.
 
double GetCompVel (void) const
 Gets the current gear compression velocity in ft/sec.
 
bool GetGearUnitDown (void) const
 
double GetGearUnitPos (void) const
 
bool GetGearUnitUp (void) const
 
double GetLocalGear (int idx) const
 
const FGColumnVector3GetLocalGear (void) const
 
const std::string & GetName (void) const
 Gets the name of the gear.
 
bool GetReport (void) const
 Get the console touchdown reporting feature.
 
bool GetRetractable (void) const
 
double GetstaticFCoeff (void) const
 
bool GetSteerable (void) const
 
double GetSteerAngleDeg (void) const
 
double GetSteerNorm (void) const
 
int GetSteerType (void) const
 
double GetWheelRollForce (void)
 
double GetWheelRollVel (void) const
 
double GetWheelSideForce (void)
 
double GetWheelSideVel (void) const
 
double GetWheelSlipAngle (void) const
 
double GetWheelVel (int axis) const
 
bool GetWOW (void) const
 Gets the Weight On Wheels flag value.
 
bool IsBogey (void) const
 
void ResetToIC (void)
 
void SetReport (bool flag)
 Set the console touchdown reporting feature.
 
void SetSteerAngleDeg (double angle)
 
void SetSteerCmd (double cmd)
 
void SetWOW (bool wow)
 Sets the weight-on-wheels flag.
 
- Public Member Functions inherited from FGForce
 FGForce (FGFDMExec *FDMExec)
 Constructor.
 
virtual ~FGForce ()
 Destructor.
 
const FGColumnVector3GetActingLocation (void) const
 
double GetActingLocationX (void) const
 
double GetActingLocationY (void) const
 
double GetActingLocationZ (void) const
 
double GetAnglesToBody (int axis) const
 
const FGColumnVector3GetAnglesToBody (void) const
 
double GetBodyXForce (void) const
 
double GetBodyYForce (void) const
 
double GetBodyZForce (void) const
 
const FGColumnVector3GetLocation (void) const
 
double GetLocationX (void) const
 
double GetLocationY (void) const
 
double GetLocationZ (void) const
 
const FGColumnVector3GetMoments (void) const
 
double GetPitch (void) const
 
TransformType GetTransformType (void) const
 
double GetYaw (void) const
 
void SetActingLocation (const FGColumnVector3 &vv)
 
void SetActingLocation (double x, double y, double z)
 Acting point of application.
 
void SetActingLocationX (double x)
 
void SetActingLocationY (double y)
 
void SetActingLocationZ (double z)
 
void SetAnglesToBody (const FGColumnVector3 &vv)
 
void SetAnglesToBody (double broll, double bpitch, double byaw)
 
void SetLocation (const FGColumnVector3 &vv)
 
void SetLocation (double x, double y, double z)
 
void SetLocationX (double x)
 
void SetLocationY (double y)
 
void SetLocationZ (double z)
 
void SetPitch (double pitch)
 
void SetTransformType (TransformType ii)
 
void SetYaw (double yaw)
 
const FGMatrix33Transform (void) const
 
void UpdateCustomTransformMatrix (void)
 
- Public Member Functions inherited from FGJSBBase
 FGJSBBase ()
 Constructor for FGJSBBase.
 
virtual ~FGJSBBase ()
 Destructor for FGJSBBase.
 
void disableHighLighting (void)
 Disables highlighting in the console output.
 

Public Attributes

const struct Inputsin
 

Additional Inherited Members

- Static Public Member Functions inherited from FGJSBBase
static const std::string & GetVersion (void)
 Returns the version number of JSBSim.
 
static constexpr double KelvinToFahrenheit (double kelvin)
 Converts from degrees Kelvin to degrees Fahrenheit.
 
static constexpr double CelsiusToRankine (double celsius)
 Converts from degrees Celsius to degrees Rankine.
 
static constexpr double RankineToCelsius (double rankine)
 Converts from degrees Rankine to degrees Celsius.
 
static constexpr double KelvinToRankine (double kelvin)
 Converts from degrees Kelvin to degrees Rankine.
 
static constexpr double RankineToKelvin (double rankine)
 Converts from degrees Rankine to degrees Kelvin.
 
static constexpr double FahrenheitToCelsius (double fahrenheit)
 Converts from degrees Fahrenheit to degrees Celsius.
 
static constexpr double CelsiusToFahrenheit (double celsius)
 Converts from degrees Celsius to degrees Fahrenheit.
 
static constexpr double CelsiusToKelvin (double celsius)
 Converts from degrees Celsius to degrees Kelvin.
 
static constexpr double KelvinToCelsius (double kelvin)
 Converts from degrees Kelvin to degrees Celsius.
 
static constexpr double FeetToMeters (double measure)
 Converts from feet to meters.
 
static bool EqualToRoundoff (double a, double b)
 Finite precision comparison.
 
static bool EqualToRoundoff (float a, float b)
 Finite precision comparison.
 
static bool EqualToRoundoff (float a, double b)
 Finite precision comparison.
 
static bool EqualToRoundoff (double a, float b)
 Finite precision comparison.
 
static constexpr double Constrain (double min, double value, double max)
 Constrain a value between a minimum and a maximum value.
 
static constexpr double sign (double num)
 
- Static Public Attributes inherited from FGJSBBase
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
 
static short debug_lvl = 1
 
- Static Protected Member Functions inherited from FGJSBBase
static std::string CreateIndexedPropertyName (const std::string &Property, int index)
 
- Protected Attributes inherited from FGForce
FGFDMExecfdmex
 
std::shared_ptr< FGMassBalanceMassBalance
 
FGMatrix33 mT
 
TransformType ttype
 
FGColumnVector3 vActingXYZn
 
FGColumnVector3 vFn
 
FGColumnVector3 vMn
 
FGColumnVector3 vOrient
 
FGColumnVector3 vXYZn
 
- Static Protected Attributes inherited from FGJSBBase
static constexpr double radtodeg = 180. / M_PI
 
static constexpr double degtorad = M_PI / 180.
 
static constexpr double hptoftlbssec = 550.0
 
static constexpr double psftoinhg = 0.014138
 
static constexpr double psftopa = 47.88
 
static constexpr double fttom = 0.3048
 
static constexpr double ktstofps = 1852./(3600*fttom)
 
static constexpr double fpstokts = 1.0 / ktstofps
 
static constexpr double inchtoft = 1.0/12.0
 
static constexpr double m3toft3 = 1.0/(fttom*fttom*fttom)
 
static constexpr double in3tom3 = inchtoft*inchtoft*inchtoft/m3toft3
 
static constexpr double inhgtopa = 3386.38
 
static constexpr double slugtolb = 32.174049
 Note that definition of lbtoslug by the inverse of slugtolb and not to a different constant you can also get from some tables will make lbtoslug*slugtolb == 1 up to the magnitude of roundoff.
 
static constexpr double lbtoslug = 1.0/slugtolb
 
static constexpr double kgtolb = 2.20462
 
static constexpr double kgtoslug = 0.06852168
 
static const std::string needed_cfg_version = "2.0"
 
static const std::string JSBSim_version = JSBSIM_VERSION " " __DATE__ " " __TIME__
 

Member Enumeration Documentation

◆ BrakeGroup

enum BrakeGroup

Brake grouping enumerators.

Definition at line 216 of file FGLGear.h.

216{bgNone=0, bgLeft, bgRight, bgCenter, bgNose, bgTail, bgNumBrakeGroups };

◆ ContactType

Contact point type.

Definition at line 220 of file FGLGear.h.

220{ctBOGEY, ctSTRUCTURE};

◆ DampType

enum DampType

Damping types.

Definition at line 224 of file FGLGear.h.

224{dtLinear=0, dtSquare};

◆ FrictionType

Friction types.

Definition at line 226 of file FGLGear.h.

226{ftRoll=0, ftSide, ftDynamic};

◆ ReportType

enum ReportType

Report type enumerators.

Definition at line 222 of file FGLGear.h.

222{erNone=0, erTakeoff, erLand};

◆ SteerType

enum SteerType

Steering group membership enumerators.

Definition at line 218 of file FGLGear.h.

218{stSteer, stFixed, stCaster};

Constructor & Destructor Documentation

◆ FGLGear()

FGLGear ( Element el,
FGFDMExec Executive,
int  number,
const struct Inputs input 
)

Constructor.

Parameters
ela pointer to the XML element that contains the CONTACT info.
Executivea pointer to the parent executive object
numberinteger identifier for this instance of FGLGear

Definition at line 73 of file FGLGear.cpp.

73 :
74 FGForce(fdmex),
75 in(inputs),
76 GearNumber(number),
77 SteerAngle(0.0),
78 Castered(false),
79 StaticFriction(false),
80 eSteerType(stSteer)
81{
82 kSpring = bDamp = bDampRebound = dynamicFCoeff = staticFCoeff = rollingFCoeff = maxSteerAngle = 0;
83 isRetractable = false;
84 eDampType = dtLinear;
85 eDampTypeRebound = dtLinear;
86
87 name = el->GetAttributeValue("name");
88 string sContactType = el->GetAttributeValue("type");
89 if (sContactType == "BOGEY") {
90 eContactType = ctBOGEY;
91 } else if (sContactType == "STRUCTURE") {
92 eContactType = ctSTRUCTURE;
93 } else {
94 // Unknown contact point types will be treated as STRUCTURE.
95 eContactType = ctSTRUCTURE;
96 }
97
98 // Default values for structural contact points
99 if (eContactType == ctSTRUCTURE) {
100 kSpring = in.EmptyWeight;
101 bDamp = kSpring;
102 bDampRebound = kSpring * 10;
103 staticFCoeff = 1.0;
104 dynamicFCoeff = 1.0;
105 }
106
107 auto PropertyManager = fdmex->GetPropertyManager();
108
109 fStrutForce = 0;
110 Element* strutForce = el->FindElement("strut_force");
111 if (strutForce) {
112 Element* springFunc = strutForce->FindElement("function");
113 fStrutForce = new FGFunction(fdmex, springFunc);
114 }
115 else {
116 if (el->FindElement("spring_coeff"))
117 kSpring = el->FindElementValueAsNumberConvertTo("spring_coeff", "LBS/FT");
118 if (el->FindElement("damping_coeff")) {
119 Element* dampCoeff = el->FindElement("damping_coeff");
120 if (dampCoeff->GetAttributeValue("type") == "SQUARE") {
121 eDampType = dtSquare;
122 bDamp = el->FindElementValueAsNumberConvertTo("damping_coeff", "LBS/FT2/SEC2");
123 } else {
124 bDamp = el->FindElementValueAsNumberConvertTo("damping_coeff", "LBS/FT/SEC");
125 }
126 }
127
128 if (el->FindElement("damping_coeff_rebound")) {
129 Element* dampCoeffRebound = el->FindElement("damping_coeff_rebound");
130 if (dampCoeffRebound->GetAttributeValue("type") == "SQUARE") {
131 eDampTypeRebound = dtSquare;
132 bDampRebound = el->FindElementValueAsNumberConvertTo("damping_coeff_rebound", "LBS/FT2/SEC2");
133 } else {
134 bDampRebound = el->FindElementValueAsNumberConvertTo("damping_coeff_rebound", "LBS/FT/SEC");
135 }
136 } else {
137 bDampRebound = bDamp;
138 eDampTypeRebound = eDampType;
139 }
140 }
141
142 if (el->FindElement("dynamic_friction"))
143 dynamicFCoeff = el->FindElementValueAsNumber("dynamic_friction");
144 if (el->FindElement("static_friction"))
145 staticFCoeff = el->FindElementValueAsNumber("static_friction");
146 if (el->FindElement("rolling_friction"))
147 rollingFCoeff = el->FindElementValueAsNumber("rolling_friction");
148 if (el->FindElement("retractable"))
149 isRetractable = ((unsigned int)el->FindElementValueAsNumber("retractable"))>0.0?true:false;
150
151 if (el->FindElement("max_steer"))
152 maxSteerAngle = el->FindElementValueAsNumberConvertTo("max_steer", "DEG");
153
154 Element* castered_el = el->FindElement("castered");
155
156 if ((maxSteerAngle == 360 && !castered_el)
157 || (castered_el && castered_el->GetDataAsNumber() != 0.0)) {
158 eSteerType = stCaster;
159 Castered = true;
160 }
161 else if (maxSteerAngle == 0.0) {
162 eSteerType = stFixed;
163 }
164 else
165 eSteerType = stSteer;
166
167 GroundReactions = fdmex->GetGroundReactions().get();
168
169 ForceY_Table = 0;
170 Element* force_table = el->FindElement("table");
171 while (force_table) {
172 string force_type = force_table->GetAttributeValue("name");
173 if (force_type == "CORNERING_COEFF") {
174 ForceY_Table = new FGTable(PropertyManager, force_table);
175 break;
176 } else {
177 FGXMLLogging log(force_table, LogLevel::ERROR);
178 log << "Undefined force table for " << name << " contact point\n";
179 }
180 force_table = el->FindNextElement("table");
181 }
182
183 Element* element = el->FindElement("location");
184 if (element) vXYZn = element->FindElementTripletConvertTo("IN");
185 else {
186 XMLLogException err(el);
187 err << "\nNo location given for contact " << name << "\n";
188 throw err;
189 }
190 SetTransformType(FGForce::tCustom);
191
192 element = el->FindElement("orientation");
193 if (element && (eContactType == ctBOGEY)) {
194 FGQuaternion quatFromEuler(element->FindElementTripletConvertTo("RAD"));
195
196 mTGear = quatFromEuler.GetT();
197 }
198 else {
199 mTGear(1,1) = 1.;
200 mTGear(2,2) = 1.;
201 mTGear(3,3) = 1.;
202 }
203
204 string sBrakeGroup = el->FindElementValue("brake_group");
205
206 if (sBrakeGroup == "LEFT" ) eBrakeGrp = bgLeft;
207 else if (sBrakeGroup == "RIGHT" ) eBrakeGrp = bgRight;
208 else if (sBrakeGroup == "CENTER") eBrakeGrp = bgCenter;
209 else if (sBrakeGroup == "NOSE" ) eBrakeGrp = bgCenter; // Nose brake is not supported by FGFCS
210 else if (sBrakeGroup == "TAIL" ) eBrakeGrp = bgCenter; // Tail brake is not supported by FGFCS
211 else if (sBrakeGroup == "NONE" ) eBrakeGrp = bgNone;
212 else if (sBrakeGroup.empty() ) eBrakeGrp = bgNone;
213 else {
214 FGXMLLogging log(el, LogLevel::ERROR);
215 log << "Improper braking group specification in config file: "
216 << sBrakeGroup << " is undefined.\n";
217 }
218
219// Add some AI here to determine if gear is located properly according to its
220// brake group type ??
221
222 useFCSGearPos = false;
223 ReportEnable = true;
224 TakeoffReported = LandingReported = false;
225
226 // Set Pacejka terms
227
228 Stiffness = 0.06;
229 Shape = 2.8;
230 Peak = staticFCoeff;
231 Curvature = 1.03;
232
233 ResetToIC();
234
235 bind(PropertyManager.get());
236
237 Debug(0);
238}
std::shared_ptr< FGGroundReactions > GetGroundReactions(void) const
Returns the FGGroundReactions pointer.
std::shared_ptr< FGPropertyManager > GetPropertyManager(void) const
Returns a pointer to the property manager object.
Definition FGFDMExec.h:422
FGForce(FGFDMExec *FDMExec)
Constructor.
Definition FGForce.cpp:53
+ Here is the call graph for this function:

◆ ~FGLGear()

~FGLGear ( )

Destructor.

Definition at line 242 of file FGLGear.cpp.

243{
244 delete ForceY_Table;
245 delete fStrutForce;
246 Debug(1);
247}

Member Function Documentation

◆ GetBodyForces()

const FGColumnVector3 & GetBodyForces ( void  )
overridevirtual

The Force vector for this gear.

Reimplemented from FGForce.

Definition at line 283 of file FGLGear.cpp.

284{
285 double gearPos = 1.0;
286
287 vFn.InitMatrix();
288
289 // Compute AGL
290 FGColumnVector3 normal, terrainVel, dummy;
291 FGLocation gearLoc, contact;
292 FGColumnVector3 vWhlBodyVec = Ts2b * (vXYZn - in.vXYZcg);
293
294 vLocalGear = in.Tb2l * vWhlBodyVec; // Get local frame wheel location
295 gearLoc = in.Location.LocalToLocation(vLocalGear);
296
297 // Compute the height of the theoretical location of the wheel (if strut is
298 // not compressed) with respect to the ground level (AGL)
299 double height = fdmex->GetInertial()->GetContactPoint(gearLoc, contact,
300 normal, terrainVel, dummy);
301
302 // Don't want strut compression when in contact with the ground to return
303 // a negative AGL
304 AGL = max(height, 0.0);
305
306 if (isRetractable) gearPos = GetGearUnitPos();
307
308 if (gearPos > 0.99) { // Gear DOWN
309
310 if (!fdmex->GetTrimStatus())
311 height -= GroundReactions->GetBumpHeight();
312 staticFFactor = GroundReactions->GetStaticFFactor();
313 rollingFFactor = GroundReactions->GetRollingFFactor();
314 maximumForce = GroundReactions->GetMaximumForce();
315 bumpiness = GroundReactions->GetBumpiness();
316 isSolid = GroundReactions->GetSolid();
317
318 FGColumnVector3 vWhlDisplVec;
319 double LGearProj = 1.0;
320
321 if (height < 0.0) {
322 WOW = true;
323 vGroundNormal = in.Tec2b * normal;
324
325 // The height returned by GetGroundCallback() is the AGL and is expressed
326 // in the Z direction of the local coordinate frame. We now need to
327 // transform this height in actual compression of the strut (BOGEY) or in
328 // the normal direction to the ground (STRUCTURE)
329 double normalZ = (in.Tec2l*normal)(eZ);
330 LGearProj = -(mTGear.Transposed() * vGroundNormal)(eZ);
331
332 // The following equations use the vector to the tire contact patch
333 // including the strut compression.
334 switch(eContactType) {
335 case ctBOGEY:
336 if (isSolid) {
337 compressLength = LGearProj > 0.0 ? height * normalZ / LGearProj : 0.0;
338 vWhlDisplVec = mTGear * FGColumnVector3(0., 0., -compressLength);
339 } else {
340 // Gears don't (or hardly) compress in liquids
341 WOW = false;
342 }
343 break;
344 case ctSTRUCTURE:
345 compressLength = height * normalZ / DotProduct(normal, normal);
346 vWhlDisplVec = compressLength * vGroundNormal;
347 break;
348 }
349 }
350 else
351 WOW = false;
352
353 if (WOW) {
354 FGColumnVector3 vWhlContactVec = vWhlBodyVec + vWhlDisplVec;
355 vActingXYZn = vXYZn + Tb2s * vWhlDisplVec;
356 FGColumnVector3 vBodyWhlVel = in.PQR * vWhlContactVec;
357 vBodyWhlVel += in.UVW - in.Tec2b * terrainVel;
358 vWhlVelVec = mTGear.Transposed() * vBodyWhlVel;
359
360 InitializeReporting();
361 ComputeSteeringAngle();
362 ComputeGroundFrame();
363
364 vGroundWhlVel = mT.Transposed() * vBodyWhlVel;
365
366 if (fdmex->GetTrimStatus() || in.TotalDeltaT == 0.0)
367 compressSpeed = 0.0; // Steady state is sought during trimming
368 else {
369 compressSpeed = -vGroundWhlVel(eZ);
370 if (eContactType == ctBOGEY)
371 compressSpeed /= LGearProj;
372
373 // If the gear is entering in contact with the ground during the current
374 // time step, the compression speed might actually be lower than the
375 // aircraft velocity projected along the gear leg (compressSpeed).
376 double maxCompressSpeed = compressLength/in.TotalDeltaT;
377 if (fabs(compressSpeed) > maxCompressSpeed)
378 compressSpeed = sign(compressSpeed)*maxCompressSpeed;
379 }
380
381 ComputeVerticalStrutForce();
382
383 // Compute the friction coefficients in the wheel ground plane.
384 if (eContactType == ctBOGEY) {
385 ComputeSlipAngle();
386 ComputeBrakeForceCoefficient();
387 ComputeSideForceCoefficient();
388 }
389
390 // Prepare the Jacobians and the Lagrange multipliers for later friction
391 // forces calculations.
392 ComputeJacobian(vWhlContactVec);
393 } else { // Gear is NOT compressed
394 compressLength = 0.0;
395 compressSpeed = 0.0;
396 WheelSlip = 0.0;
397 StrutForce = 0.0;
398 vWhlDisplVec.InitMatrix();
399
400 LMultiplier[ftRoll].value = 0.0;
401 LMultiplier[ftSide].value = 0.0;
402 LMultiplier[ftDynamic].value = 0.0;
403
404 // Return to neutral position between 1.0 and 0.8 gear pos.
405 SteerAngle *= max(gearPos-0.8, 0.0)/0.2;
406
407 ResetReporting();
408 }
409 }
410
411 if (!WOW) {
412 // Let wheel spin down slowly
413 vWhlVelVec(eX) -= 13.0 * in.TotalDeltaT;
414 if (vWhlVelVec(eX) < 0.0) vWhlVelVec(eX) = 0.0;
415 }
416
417 if (!fdmex->GetTrimStatus()) {
418 ReportTakeoffOrLanding();
419
420 // Require both WOW and LastWOW to be true before checking crash conditions
421 // to allow the WOW flag to be used in terminating a scripted run.
422 if (WOW && lastWOW) CrashDetect();
423
424 lastWOW = WOW;
425 }
426
427 return FGForce::GetBodyForces();
428}
std::shared_ptr< FGInertial > GetInertial(void) const
Returns the FGInertial pointer.
FGLocation LocalToLocation(const FGColumnVector3 &lvec) const
Conversion from Local frame coordinates to a location in the earth centered and fixed frame.
Definition FGLocation.h:326
FGMatrix33 Transposed(void) const
Transposed matrix.
Definition FGMatrix33.h:221
bool GetSolid(void)
Gets the surface is a solid flag value.
Definition FGSurface.h:107
double GetBumpiness(void)
Gets the normalized bumpiness factor associated with the surface.
Definition FGSurface.h:104
double GetRollingFFactor(void)
Gets the rolling friction factor of the surface area.
Definition FGSurface.h:98
double GetMaximumForce(void)
Gets the maximum force of the surface area.
Definition FGSurface.h:101
double GetBumpHeight()
Returns the height of the bump at the provided offset.
Definition FGSurface.cpp:92
double GetStaticFFactor(void)
Gets the static friction factor of the surface area.
Definition FGSurface.h:95
double DotProduct(const FGColumnVector3 &v1, const FGColumnVector3 &v2)
Dot product of two vectors Compute and return the euclidean dot (or scalar) product of two vectors v1...
+ Here is the call graph for this function:

◆ GetBodyLocation() [1/2]

double GetBodyLocation ( int  idx) const
inline

Definition at line 243 of file FGLGear.h.

243 {
244 FGColumnVector3 vWhlBodyVec = Ts2b * (vXYZn - in.vXYZcg);
245 return vWhlBodyVec(idx);
246 }

◆ GetBodyLocation() [2/2]

FGColumnVector3 GetBodyLocation ( void  ) const
inline

Gets the location of the gear in Body axes.

Definition at line 240 of file FGLGear.h.

240 {
241 return Ts2b * (vXYZn - in.vXYZcg);
242 }

◆ GetBodyXForce()

double GetBodyXForce ( void  )
inline

Definition at line 293 of file FGLGear.h.

293 {
294 UpdateForces();
295 return FGForce::GetBodyForces()(eX);
296 }

◆ GetBodyYForce()

double GetBodyYForce ( void  )
inline

Definition at line 297 of file FGLGear.h.

297 {
298 UpdateForces();
299 return FGForce::GetBodyForces()(eY);
300 }

◆ GetBodyZForce()

double GetBodyZForce ( void  )
inline

Definition at line 301 of file FGLGear.h.

301 {
302 UpdateForces();
303 return FGForce::GetBodyForces()(eZ);
304 }

◆ GetBrakeGroup()

int GetBrakeGroup ( void  ) const
inline

Definition at line 277 of file FGLGear.h.

277{ return (int)eBrakeGrp; }

◆ GetCompForce()

double GetCompForce ( void  ) const
inline

Gets the gear compression force in pounds.

Definition at line 260 of file FGLGear.h.

260{return StrutForce; }

◆ GetCompLen()

double GetCompLen ( void  ) const
inline

Gets the current compressed length of the gear in feet.

Definition at line 256 of file FGLGear.h.

256{return compressLength;}

◆ GetCompVel()

double GetCompVel ( void  ) const
inline

Gets the current gear compression velocity in ft/sec.

Definition at line 258 of file FGLGear.h.

258{return compressSpeed; }

◆ GetGearUnitDown()

bool GetGearUnitDown ( void  ) const
inline

Definition at line 283 of file FGLGear.h.

283{ return isRetractable ? (GetGearUnitPos() > 0.99) : true; }

◆ GetGearUnitPos()

double GetGearUnitPos ( void  ) const

Definition at line 673 of file FGLGear.cpp.

674{
675 // hack to provide backward compatibility to gear/gear-pos-norm property
676 if( useFCSGearPos || in.FCSGearPos != 1.0 ) {
677 useFCSGearPos = true;
678 return in.FCSGearPos;
679 }
680 return GearPos;
681}

◆ GetGearUnitUp()

bool GetGearUnitUp ( void  ) const
inline

Definition at line 282 of file FGLGear.h.

282{ return isRetractable ? (GetGearUnitPos() < 0.01) : false; }

◆ GetLocalGear() [1/2]

double GetLocalGear ( int  idx) const
inline

Definition at line 249 of file FGLGear.h.

249{ return vLocalGear(idx); }

◆ GetLocalGear() [2/2]

const FGColumnVector3 & GetLocalGear ( void  ) const
inline

Definition at line 248 of file FGLGear.h.

248{ return vLocalGear; }

◆ GetName()

const std::string & GetName ( void  ) const
inline

Gets the name of the gear.

Definition at line 252 of file FGLGear.h.

252{return name; }

◆ GetReport()

bool GetReport ( void  ) const
inline

Get the console touchdown reporting feature.

Returns
true if reporting is turned on

Definition at line 270 of file FGLGear.h.

270{ return ReportEnable; }

◆ GetRetractable()

bool GetRetractable ( void  ) const
inline

Definition at line 281 of file FGLGear.h.

281{ return isRetractable; }

◆ GetstaticFCoeff()

double GetstaticFCoeff ( void  ) const
inline

Definition at line 275 of file FGLGear.h.

275{ return staticFCoeff; }

◆ GetSteerable()

bool GetSteerable ( void  ) const
inline

Definition at line 280 of file FGLGear.h.

280{ return eSteerType != stFixed; }

◆ GetSteerAngleDeg()

double GetSteerAngleDeg ( void  ) const
inline

Definition at line 313 of file FGLGear.h.

313{ return radtodeg*SteerAngle; }

◆ GetSteerNorm()

double GetSteerNorm ( void  ) const
inline

Definition at line 271 of file FGLGear.h.

271 {
272 return maxSteerAngle == 0.0 ? 0.0 : radtodeg/maxSteerAngle*SteerAngle;
273 }

◆ GetSteerType()

int GetSteerType ( void  ) const
inline

Definition at line 278 of file FGLGear.h.

278{ return (int)eSteerType; }

◆ GetWheelRollForce()

double GetWheelRollForce ( void  )
inline

Definition at line 285 of file FGLGear.h.

285 {
286 UpdateForces();
287 FGColumnVector3 vForce = mTGear.Transposed() * FGForce::GetBodyForces();
288 return vForce(eX)*cos(SteerAngle) + vForce(eY)*sin(SteerAngle); }

◆ GetWheelRollVel()

double GetWheelRollVel ( void  ) const
inline

Definition at line 305 of file FGLGear.h.

305 { return vWhlVelVec(eX)*cos(SteerAngle)
306 + vWhlVelVec(eY)*sin(SteerAngle); }

◆ GetWheelSideForce()

double GetWheelSideForce ( void  )
inline

Definition at line 289 of file FGLGear.h.

289 {
290 UpdateForces();
291 FGColumnVector3 vForce = mTGear.Transposed() * FGForce::GetBodyForces();
292 return vForce(eY)*cos(SteerAngle) - vForce(eX)*sin(SteerAngle); }

◆ GetWheelSideVel()

double GetWheelSideVel ( void  ) const
inline

Definition at line 307 of file FGLGear.h.

307 { return vWhlVelVec(eY)*cos(SteerAngle)
308 - vWhlVelVec(eX)*sin(SteerAngle); }

◆ GetWheelSlipAngle()

double GetWheelSlipAngle ( void  ) const
inline

Definition at line 309 of file FGLGear.h.

309{ return WheelSlip; }

◆ GetWheelVel()

double GetWheelVel ( int  axis) const
inline

Definition at line 310 of file FGLGear.h.

310{ return vWhlVelVec(axis);}

◆ GetWOW()

bool GetWOW ( void  ) const
inline

Gets the Weight On Wheels flag value.

Definition at line 254 of file FGLGear.h.

254{return WOW; }

◆ IsBogey()

bool IsBogey ( void  ) const
inline

Definition at line 311 of file FGLGear.h.

311{ return (eContactType == ctBOGEY);}

◆ ResetToIC()

void ResetToIC ( void  )

Definition at line 251 of file FGLGear.cpp.

252{
253 GearPos = 1.0;
254
255 WOW = lastWOW = false;
256 FirstContact = false;
257 StartedGroundRun = false;
258 LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0;
259 MaximumStrutForce = MaximumStrutTravel = 0.0;
260 SinkRate = GroundSpeed = 0.0;
261 SteerAngle = 0.0;
262
263 vWhlVelVec.InitMatrix();
264
265 compressLength = 0.0;
266 compressSpeed = 0.0;
267 maxCompLen = 0.0;
268
269 WheelSlip = 0.0;
270
271 // Initialize Lagrange multipliers
272 for (int i=0; i < 3; i++) {
273 LMultiplier[i].ForceJacobian.InitMatrix();
274 LMultiplier[i].LeverArm.InitMatrix();
275 LMultiplier[i].Min = 0.0;
276 LMultiplier[i].Max = 0.0;
277 LMultiplier[i].value = 0.0;
278 }
279}

◆ SetReport()

void SetReport ( bool  flag)
inline

Set the console touchdown reporting feature.

Parameters
flagtrue turns on touchdown reporting, false turns it off

Definition at line 267 of file FGLGear.h.

267{ ReportEnable = flag; }

◆ SetSteerAngleDeg()

void SetSteerAngleDeg ( double  angle)
inline

Definition at line 314 of file FGLGear.h.

314 {
315 if (eSteerType != stFixed && !Castered)
316 SteerAngle = degtorad * angle;
317 }

◆ SetSteerCmd()

void SetSteerCmd ( double  cmd)
inline

Definition at line 274 of file FGLGear.h.

274{ SetSteerAngleDeg(cmd * maxSteerAngle); }

◆ SetWOW()

void SetWOW ( bool  wow)
inline

Sets the weight-on-wheels flag.

Definition at line 263 of file FGLGear.h.

263{WOW = wow;}

Member Data Documentation

◆ in

const struct Inputs& in

Definition at line 319 of file FGLGear.h.


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