JSBSim Flight Dynamics Model 1.2.3 (07 Jun 2025)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGAccelerations.h
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGAccelerations.h
4 Author: Jon S. Berndt
5 Date started: 07/12/11
6
7 ------------- Copyright (C) 2011 Jon S. Berndt (jon@jsbsim.org) -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on the world wide web at http://www.gnu.org.
25
26HISTORY
27--------------------------------------------------------------------------------
2807/12/11 JSB Created
29
30%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31SENTRY
32%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34#ifndef FGACCELERATIONS_H
35#define FGACCELERATIONS_H
36
37/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38INCLUDES
39%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41#include "models/FGModel.h"
42#include "math/FGColumnVector3.h"
43#include "math/LagrangeMultiplier.h"
44#include "math/FGMatrix33.h"
45
46/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47FORWARD DECLARATIONS
48%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50namespace JSBSim {
51
52/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53CLASS DOCUMENTATION
54%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55
91/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92CLASS DECLARATION
93%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
94
95class FGAccelerations : public FGModel {
96public:
99 explicit FGAccelerations(FGFDMExec* Executive);
100
103
107 bool InitModel(void) override;
108
116 bool Run(bool Holding) override;
117
130 const FGColumnVector3& GetUVWdot(void) const { return vUVWdot; }
131
146 const FGColumnVector3& GetUVWidot(void) const { return vUVWidot; }
147 double GetUVWidot(int idx) const { return vUVWidot(idx); }
148
162 const FGColumnVector3& GetPQRdot(void) const {return vPQRdot;}
163
177 const FGColumnVector3& GetPQRidot(void) const {return vPQRidot;}
178 double GetPQRidot(int idx) const { return vPQRidot(idx); }
179
191 double GetUVWdot(int idx) const { return vUVWdot(idx); }
192
205 const FGColumnVector3& GetBodyAccel(void) const { return vBodyAccel; }
206
207 double GetGravAccelMagnitude(void) const { return in.vGravAccel.Magnitude(); }
208
221 double GetBodyAccel(int idx) const { return vBodyAccel(idx); }
222
235 double GetPQRdot(int axis) const {return vPQRdot(axis);}
236
249 double GetMoments(int idx) const { return in.Moment(idx) + vFrictionMoments(idx); }
250 FGColumnVector3 GetMoments(void) const { return in.Moment + vFrictionMoments; }
251
263 double GetForces(int idx) const { return in.Force(idx) + vFrictionForces(idx); }
264 FGColumnVector3 GetForces(void) const { return in.Force + vFrictionForces; }
265
277 double GetGroundMoments(int idx) const { return in.GroundMoment(idx) + vFrictionMoments(idx); }
278 FGColumnVector3 GetGroundMoments(void) const { return in.GroundMoment + vFrictionMoments; }
279
291 double GetGroundForces(int idx) const { return in.GroundForce(idx) + vFrictionForces(idx); }
292 FGColumnVector3 GetGroundForces(void) const { return in.GroundForce + vFrictionForces; }
293
305 double GetWeight(int idx) const { return in.Mass * (in.Tec2b * in.vGravAccel)(idx); }
306 FGColumnVector3 GetWeight(void) const { return in.Mass * in.Tec2b * in.vGravAccel; }
307
312 void InitializeDerivatives(void);
313
318 void SetHoldDown(bool hd);
319
364
365private:
366
367 FGColumnVector3 vPQRdot, vPQRidot;
368 FGColumnVector3 vUVWdot, vUVWidot;
369 FGColumnVector3 vBodyAccel;
370 FGColumnVector3 vFrictionForces;
371 FGColumnVector3 vFrictionMoments;
372
373 bool gravTorque;
374
375 void CalculatePQRdot(void);
376 void CalculateUVWdot(void);
377
378 void CalculateFrictionForces(double dt);
379
380 void bind(void);
381 void Debug(int from) override;
382};
383}
384//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
385#endif
Handles the calculation of accelerations.
double GetBodyAccel(int idx) const
Retrieves a component of the acceleration resulting from the applied forces.
void InitializeDerivatives(void)
Initializes the FGAccelerations class prior to a new execution.
const FGColumnVector3 & GetUVWidot(void) const
Retrieves the body axis acceleration in the ECI frame.
const FGColumnVector3 & GetUVWdot(void) const
Retrieves the body axis acceleration.
double GetGroundMoments(int idx) const
Retrieves the ground moments applied on the body.
const FGColumnVector3 & GetBodyAccel(void) const
Retrieves the acceleration resulting from the applied forces.
double GetMoments(int idx) const
Retrieves a component of the total moments applied on the body.
bool Run(bool Holding) override
Runs the state propagation model; called by the Executive Can pass in a value indicating if the execu...
double GetPQRdot(int axis) const
Retrieves a body frame angular acceleration component.
bool InitModel(void) override
Initializes the FGAccelerations class after instantiation and prior to first execution.
double GetUVWdot(int idx) const
Retrieves a body frame acceleration component.
double GetGroundForces(int idx) const
Retrieves the ground forces applied on the body.
const FGColumnVector3 & GetPQRdot(void) const
Retrieves the body axis angular acceleration vector.
const FGColumnVector3 & GetPQRidot(void) const
Retrieves the axis angular acceleration vector in the ECI frame.
double GetWeight(int idx) const
Retrieves the weight applied on the body.
void SetHoldDown(bool hd)
Sets the property forces/hold-down.
double GetForces(int idx) const
Retrieves the total forces applied on the body.
This class implements a 3 element column vector.
double Magnitude(void) const
Length of the vector.
Encapsulates the JSBSim simulation executive.
Definition FGFDMExec.h:184
Handles matrix math operations.
Definition FGMatrix33.h:70
Base class for all scheduled JSBSim models.
Definition FGModel.h:70
FGColumnVector3 TerrainVelocity
Terrain velocities with respect to the local frame (expressed in the ECEF frame).
FGColumnVector3 GroundMoment
Moments generated by the ground normal reactions expressed in the body frame. Does not account for fr...
FGColumnVector3 vUVW
Velocities of the body with respect to the local frame (expressed in the body frame).
FGMatrix33 Tb2i
Transformation matrix from the Body to the ECI frame.
FGMatrix33 J
The body inertia matrix expressed in the body frame.
FGColumnVector3 vPQRi
Angular velocities of the body with respect to the ECI frame (expressed in the body frame).
FGColumnVector3 Moment
Total moments applied to the body except friction and gravity (expressed in the body frame)
FGMatrix33 Jinv
The inverse of the inertia matrix J.
FGColumnVector3 vOmegaPlanet
Earth rotating vector (expressed in the ECI frame).
FGColumnVector3 vInertialPosition
Body position (X,Y,Z) measured in the ECI frame.
FGColumnVector3 vPQR
Angular velocities of the body with respect to the local frame (expressed in the body frame).
FGColumnVector3 vGravAccel
Gravity intensity vector (expressed in the ECEF frame).
FGMatrix33 Tec2i
Transformation matrix from the ECEF to the ECI frame.
std::vector< LagrangeMultiplier * > * MultipliersList
List of Lagrange multipliers set by FGLGear for friction forces calculations.
FGMatrix33 Tec2b
Transformation matrix from the ECEF to the Body frame.
FGColumnVector3 GroundForce
Forces generated by the ground normal reactions expressed in the body frame. Does not account for fri...
FGColumnVector3 TerrainAngularVel
Terrain angular velocities with respect to the local frame (expressed in the ECEF frame).
FGColumnVector3 Force
Total forces applied to the body except friction and gravity (expressed in the body frame)
FGMatrix33 Ti2b
Transformation matrix from the ECI to the Body frame.