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
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 FGColumnVector3GetForces (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 FGColumnVector3GetMoments (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 *)
 Constructor.
 
 ~FGModel () override
 Destructor.
 
virtual SGPath FindFullPathName (const SGPath &path) const
 
FGFDMExecGetExec (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< FGFunctionGetPreFunction (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.
 
void disableHighLighting (void)
 Disables highlighting in the console output.
 
- 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 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
 
- 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
unsigned int exe_ctr
 
FGFDMExecFDMExec
 
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 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__
 

Constructor & Destructor Documentation

◆ FGGroundReactions()

Definition at line 54 of file FGGroundReactions.cpp.

54 :
55 FGModel(fgex),
56 FGSurface(fgex),
57 DsCmd(0.0)
58{
59 Name = "FGGroundReactions";
60
61 bind();
62
63 Debug(0);
64}
FGModel(FGFDMExec *)
Constructor.
Definition FGModel.cpp:58
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 160 of file FGGroundReactions.cpp.

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

◆ GetGroundReactionValues()

string GetGroundReactionValues ( std::string  delimeter) const

Definition at line 200 of file FGGroundReactions.cpp.

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

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

◆ InitModel()

bool InitModel ( void  )
overridevirtual

Reimplemented from FGModelFunctions.

Definition at line 68 of file FGGroundReactions.cpp.

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

◆ Load()

bool Load ( Element el)
overridevirtual

Reimplemented from FGModel.

Definition at line 135 of file FGGroundReactions.cpp.

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

◆ 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 86 of file FGGroundReactions.cpp.

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

◆ SetDsCmd()

void SetDsCmd ( double  cmd)

Sets the steering command.

Parameters
cmdsteering command in percent

Definition at line 126 of file FGGroundReactions.cpp.

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

Member Data Documentation

◆ in

Definition at line 122 of file FGGroundReactions.h.


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