JSBSim Flight Dynamics Model 1.3.3 (16 Oct 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGGroundReactions Class Reference

Detailed Description

Manages ground reactions modeling.

Maintains a list of landing gear and ground contact points, all instances of FGLGear. Sums their forces and moments so that these may be provided to FGPropagate. Parses the <ground_reactions> section of the aircraft configuration file.

Configuration File Format of <ground_reactions> Section:

<ground_reactions>
<contact>
... {see FGLGear for specifics of this format}
</contact>
... {more contacts}
</ground_reactions>

Definition at line 79 of file FGGroundReactions.h.

#include <FGGroundReactions.h>

+ Inheritance diagram for FGGroundReactions:
+ Collaboration diagram for FGGroundReactions:

Public Member Functions

 FGGroundReactions (FGFDMExec *)
 
double GetDsCmd (void) const
 Gets the steering command.
 
double GetForces (int idx) const
 
const FGColumnVector3 & GetForces (void) const
 
auto GetGearUnit (int gear) const
 Gets a gear instance.
 
std::string GetGroundReactionStrings (std::string delimeter) const
 
std::string GetGroundReactionValues (std::string delimeter) const
 
double GetMoments (int idx) const
 
const FGColumnVector3 & GetMoments (void) const
 
std::vector< LagrangeMultiplier * > * GetMultipliersList (void)
 
int GetNumGearUnits (void) const
 Gets the number of gears.
 
bool GetWOW (void) const
 
bool InitModel (void) override
 
bool Load (Element *el) override
 
void RegisterLagrangeMultiplier (LagrangeMultiplier *lmult)
 
bool Run (bool Holding) override
 Runs the Ground Reactions model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold.
 
void SetDsCmd (double cmd)
 Sets the steering command.
 
- Public Member Functions inherited from FGModel
 FGModel (FGFDMExec *, const std::string &name)
 Constructor.
 
 ~FGModel () override
 Destructor.
 
virtual SGPath FindFullPathName (const SGPath &path) const
 
FGFDMExec * GetExec (void) const
 
const std::string & GetName (void) const
 
unsigned int GetRate (void) const
 Get the output rate for the model in frames.
 
bool InitModel (void) override
 
void SetPropertyManager (std::shared_ptr< FGPropertyManager > fgpm)
 
void SetRate (unsigned int tt)
 Set the ouput rate for the model in frames.
 
- Public Member Functions inherited from FGModelFunctions
std::string GetFunctionStrings (const std::string &delimeter) const
 Gets the strings for the current set of functions.
 
std::string GetFunctionValues (const std::string &delimeter) const
 Gets the function values.
 
std::shared_ptr< FGFunction > GetPreFunction (const std::string &name)
 Get one of the "pre" function.
 
bool Load (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void PostLoad (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void PreLoad (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void RunPostFunctions (void)
 
void RunPreFunctions (void)
 
- Public Member Functions inherited from FGJSBBase
 FGJSBBase ()
 Constructor for FGJSBBase.
 
virtual ~FGJSBBase ()
 Destructor for FGJSBBase.
 
- Public Member Functions inherited from FGSurface
 FGSurface (FGFDMExec *fdmex)
 Constructor.
 
void bind (FGPropertyManager *pm)
 
double GetBumpHeight ()
 Returns the height of the bump at the provided offset.
 
double GetBumpiness (void)
 Gets the normalized bumpiness factor associated with the surface.
 
double GetMaximumForce (void)
 Gets the maximum force of the surface area.
 
double GetRollingFFactor (void)
 Gets the rolling friction factor of the surface area.
 
bool GetSolid (void)
 Gets the surface is a solid flag value.
 
double GetStaticFFactor (void)
 Gets the static friction factor of the surface area.
 
void resetValues (void)
 Reset all surface values to a default.
 
void SetBumpiness (double bump)
 Sets the normalized bumpiness factor associated with the surface.
 
void SetMaximumForce (double force)
 Sets the maximum force for the surface area.
 
void SetPosition (const double pt[3])
 Set the currect position for bumpiness calulcation.
 
void SetRollingFFactor (double friction)
 Sets the rolling friction factor of the surface area.
 
void SetSolid (bool solid)
 Sets the surface is a solid flag value.
 
void SetStaticFFactor (double friction)
 Sets the static friction factor of the surface area.
 

Public Attributes

FGLGear::Inputs in
 

Additional Inherited Members

- 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...
 
- Static Public Member Functions inherited from FGJSBBase
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 CelsiusToRankine (double celsius)
 Converts from degrees Celsius to degrees Rankine.
 
static constexpr 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.
 
static bool EqualToRoundoff (double a, float b)
 Finite precision comparison.
 
static bool EqualToRoundoff (float a, double b)
 Finite precision comparison.
 
static bool EqualToRoundoff (float a, float b)
 Finite precision comparison.
 
static constexpr double FahrenheitToCelsius (double fahrenheit)
 Converts from degrees Fahrenheit to degrees Celsius.
 
static constexpr double FeetToMeters (double measure)
 Converts from feet to meters.
 
static const std::string & GetVersion (void)
 Returns the version number of JSBSim.
 
static constexpr double KelvinToCelsius (double kelvin)
 Converts from degrees Kelvin to degrees Celsius.
 
static constexpr double KelvinToFahrenheit (double kelvin)
 Converts from degrees Kelvin to degrees Fahrenheit.
 
static constexpr double KelvinToRankine (double kelvin)
 Converts from degrees Kelvin to degrees Rankine.
 
static constexpr double RankineToCelsius (double rankine)
 Converts from degrees Rankine to degrees Celsius.
 
static constexpr double RankineToKelvin (double rankine)
 Converts from degrees Rankine to degrees Kelvin.
 
static constexpr double sign (double num)
 
- Static Public Attributes inherited from FGJSBBase
static short debug_lvl = 1
 
- Protected Member Functions inherited from FGModel
bool Upload (Element *el, bool preLoad)
 Uploads this model in memory.
 
- Static Protected Member Functions inherited from FGJSBBase
static std::string CreateIndexedPropertyName (const std::string &Property, int index)
 
- Protected Attributes inherited from FGModel
bool enabled = true
 
unsigned int exe_ctr
 
FGFDMExec * FDMExec
 
std::string Name
 
std::shared_ptr< FGPropertyManager > PropertyManager
 
unsigned int rate
 
- Protected Attributes inherited from FGModelFunctions
FGPropertyReader LocalProperties
 
std::vector< std::shared_ptr< FGFunction > > PostFunctions
 
std::vector< std::shared_ptr< FGFunction > > PreFunctions
 
- Protected Attributes inherited from FGSurface
double bumpiness
 
bool isSolid
 
double maximumForce
 
double rollingFFactor
 
double staticFFactor
 
- Static Protected Attributes inherited from FGJSBBase
static constexpr double degtorad = M_PI / 180.
 
static constexpr double fpstokts = 1.0 / ktstofps
 
static constexpr double fttom = 0.3048
 
static constexpr double hptoftlbssec = 550.0
 
static constexpr double in3tom3 = inchtoft*inchtoft*inchtoft/m3toft3
 
static constexpr double inchtoft = 1.0/12.0
 
static constexpr double inhgtopa = 3386.38
 
static const std::string JSBSim_version = JSBSIM_VERSION " " __DATE__ " " __TIME__
 
static constexpr double kgtolb = 2.20462
 
static constexpr double kgtoslug = 0.06852168
 
static constexpr double ktstofps = 1852./(3600*fttom)
 
static constexpr double lbtoslug = 1.0/slugtolb
 
static constexpr double m3toft3 = 1.0/(fttom*fttom*fttom)
 
static const std::string needed_cfg_version = "2.0"
 
static constexpr double psftoinhg = 0.014138
 
static constexpr double psftopa = 47.88
 
static constexpr double radtodeg = 180. / M_PI
 
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.
 

Constructor & Destructor Documentation

◆ FGGroundReactions()

Definition at line 54 of file FGGroundReactions.cpp.

54 :
55 FGModel(fgex, "FGGroundReactions"),
56 FGSurface(fgex),
57 DsCmd(0.0)
58{
59 bind();
60
61 Debug(0);
62}
FGModel(FGFDMExec *, const std::string &name)
Constructor.
Definition FGModel.cpp:59
FGSurface(FGFDMExec *fdmex)
Constructor.
Definition FGSurface.cpp:52

Member Function Documentation

◆ GetDsCmd()

double GetDsCmd ( void  ) const
inline

Gets the steering command.

Returns
steering command in range from -1.0 - 1.0

Definition at line 113 of file FGGroundReactions.h.

113{ return DsCmd; }

◆ GetForces() [1/2]

double GetForces ( int  idx) const
inline

Definition at line 95 of file FGGroundReactions.h.

95{return vForces(idx);}

◆ GetForces() [2/2]

const FGColumnVector3 & GetForces ( void  ) const
inline

Definition at line 94 of file FGGroundReactions.h.

94{return vForces;}

◆ GetGearUnit()

auto GetGearUnit ( int  gear) const
inline

Gets a gear instance.

Parameters
gearindex of gear instance
Returns
a pointer to the FGLGear instance of the gear unit requested

Definition at line 109 of file FGGroundReactions.h.

109{ return lGear[gear]; }

◆ GetGroundReactionStrings()

string GetGroundReactionStrings ( std::string  delimeter) const

Definition at line 158 of file FGGroundReactions.cpp.

159{
160 std::ostringstream buf;
161
162 for (auto& gear:lGear) {
163 string name = gear->GetName();
164 if (gear->IsBogey()) {
165 buf << name << " WOW" << delimeter
166 << name << " stroke (ft)" << delimeter
167 << name << " stroke velocity (ft/sec)" << delimeter
168 << name << " compress force (lbs)" << delimeter
169 << name << " wheel side force (lbs)" << delimeter
170 << name << " wheel roll force (lbs)" << delimeter
171 << name << " body X force (lbs)" << delimeter
172 << name << " body Y force (lbs)" << delimeter
173 << name << " wheel velocity vec X (ft/sec)" << delimeter
174 << name << " wheel velocity vec Y (ft/sec)" << delimeter
175 << name << " wheel rolling velocity (ft/sec)" << delimeter
176 << name << " wheel side velocity (ft/sec)" << delimeter
177 << name << " wheel slip (deg)" << delimeter;
178 } else {
179 buf << name << " WOW" << delimeter
180 << name << " stroke (ft)" << delimeter
181 << name << " stroke velocity (ft/sec)" << delimeter
182 << name << " compress force (lbs)" << delimeter;
183 }
184 }
185
186 buf << " Total Gear Force_X (lbs)" << delimeter
187 << " Total Gear Force_Y (lbs)" << delimeter
188 << " Total Gear Force_Z (lbs)" << delimeter
189 << " Total Gear Moment_L (ft-lbs)" << delimeter
190 << " Total Gear Moment_M (ft-lbs)" << delimeter
191 << " Total Gear Moment_N (ft-lbs)";
192
193 return buf.str();
194}

◆ GetGroundReactionValues()

string GetGroundReactionValues ( std::string  delimeter) const

Definition at line 198 of file FGGroundReactions.cpp.

199{
200 std::ostringstream buf;
201
202 for (auto& gear: lGear) {
203 if (gear->IsBogey()) {
204 buf << (gear->GetWOW() ? "1" : "0") << delimeter
205 << setprecision(5) << gear->GetCompLen() << delimeter
206 << setprecision(6) << gear->GetCompVel() << delimeter
207 << setprecision(10) << gear->GetCompForce() << delimeter
208 << gear->GetWheelSideForce() << delimeter
209 << gear->GetWheelRollForce() << delimeter
210 << gear->GetBodyXForce() << delimeter
211 << gear->GetBodyYForce() << delimeter
212 << setprecision(6) << gear->GetWheelVel(eX) << delimeter
213 << gear->GetWheelVel(eY) << delimeter
214 << gear->GetWheelRollVel() << delimeter
215 << gear->GetWheelSideVel() << delimeter
216 << gear->GetWheelSlipAngle() << delimeter;
217 } else {
218 buf << (gear->GetWOW() ? "1" : "0") << delimeter
219 << setprecision(5) << gear->GetCompLen() << delimeter
220 << setprecision(6) << gear->GetCompVel() << delimeter
221 << setprecision(10) << gear->GetCompForce() << delimeter;
222 }
223 }
224
225 auto Accelerations = FDMExec->GetAccelerations();
226
227 buf << Accelerations->GetGroundForces(eX) << delimeter
228 << Accelerations->GetGroundForces(eY) << delimeter
229 << Accelerations->GetGroundForces(eZ) << delimeter
230 << Accelerations->GetGroundMoments(eX) << delimeter
231 << Accelerations->GetGroundMoments(eY) << delimeter
232 << Accelerations->GetGroundMoments(eZ);
233
234 return buf.str();
235}
std::shared_ptr< FGAccelerations > GetAccelerations(void) const
Returns the FGAccelerations pointer.

◆ GetMoments() [1/2]

double GetMoments ( int  idx) const
inline

Definition at line 97 of file FGGroundReactions.h.

97{return vMoments(idx);}

◆ GetMoments() [2/2]

const FGColumnVector3 & GetMoments ( void  ) const
inline

Definition at line 96 of file FGGroundReactions.h.

96{return vMoments;}

◆ GetMultipliersList()

std::vector< LagrangeMultiplier * > * GetMultipliersList ( void  )
inline

Definition at line 120 of file FGGroundReactions.h.

120{ return &multipliers; }

◆ GetNumGearUnits()

int GetNumGearUnits ( void  ) const
inline

Gets the number of gears.

Returns
the number of gears of the aircraft.

Definition at line 104 of file FGGroundReactions.h.

104{ return (int)lGear.size(); }

◆ GetWOW()

bool GetWOW ( void  ) const

Definition at line 113 of file FGGroundReactions.cpp.

114{
115 for (auto& gear:lGear) {
116 if (gear->IsBogey() && gear->GetWOW())
117 return true;
118 }
119 return false;
120}

◆ InitModel()

bool InitModel ( void  )
overridevirtual

Reimplemented from FGModelFunctions.

Definition at line 66 of file FGGroundReactions.cpp.

67{
68 if (!FGModel::InitModel()) return false;
69
70 vForces.InitMatrix();
71 vMoments.InitMatrix();
72 DsCmd = 0.0;
73
74 multipliers.clear();
75
76 for (auto& gear: lGear)
77 gear->ResetToIC();
78
79 return true;
80}

◆ Load()

bool Load ( Element *  el)
overridevirtual

Reimplemented from FGModel.

Definition at line 133 of file FGGroundReactions.cpp.

134{
135 int num=0;
136
137 Name = "Ground Reactions Model: " + document->GetAttributeValue("name");
138
139 Debug(2);
140
141 // Perform base class Pre-Load
142 if (!FGModel::Upload(document, true))
143 return false;
144
145 Element* contact_element = document->FindElement("contact");
146 while (contact_element) {
147 lGear.push_back(make_shared<FGLGear>(contact_element, FDMExec, num++, in));
148 contact_element = document->FindNextElement("contact");
149 }
150
151 PostLoad(document, FDMExec);
152
153 return true;
154}
bool Upload(Element *el, bool preLoad)
Uploads this model in memory.
Definition FGModel.cpp:123

◆ RegisterLagrangeMultiplier()

void RegisterLagrangeMultiplier ( LagrangeMultiplier *  lmult)
inline

Definition at line 119 of file FGGroundReactions.h.

119{ multipliers.push_back(lmult); }

◆ Run()

bool Run ( bool  Holding)
overridevirtual

Runs the Ground Reactions model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold.

Parameters
Holdingif true, the executive has been directed to hold the sim from advancing time. Some models may ignore this flag, such as the Input model, which may need to be active to listen on a socket for the "Resume" command to be given.
Returns
false if no error

Reimplemented from FGModel.

Definition at line 84 of file FGGroundReactions.cpp.

85{
86 if (FGModel::Run(Holding)) return true;
87 if (Holding) return false;
88
89 RunPreFunctions();
90
91 vForces.InitMatrix();
92 vMoments.InitMatrix();
93
94 multipliers.clear();
95
96 // Sum forces and moments for all gear, here.
97 // Some optimizations may be made here - or rather in the gear code itself.
98 // The gear ::Run() method is called several times - once for each gear.
99 // Perhaps there is some commonality for things which only need to be
100 // calculated once.
101 for (auto& gear:lGear) {
102 vForces += gear->GetBodyForces();
103 vMoments += gear->GetMoments();
104 }
105
106 RunPostFunctions();
107
108 return false;
109}
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
Definition FGModel.cpp:101

◆ SetDsCmd()

void SetDsCmd ( double  cmd)

Sets the steering command.

Parameters
cmdsteering command in percent

Definition at line 124 of file FGGroundReactions.cpp.

125{
126 DsCmd = cmd;
127 for (auto& gear:lGear)
128 gear->SetSteerCmd(cmd);
129}

Member Data Documentation

◆ in

Definition at line 122 of file FGGroundReactions.h.


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