JSBSim Flight Dynamics Model  1.2.0 (05 Nov 2023)
An Open Source Flight Dynamics and Control Software Library in C++
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 
26 HISTORY
27 --------------------------------------------------------------------------------
28 07/12/11 JSB Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGACCELERATIONS_H
35 #define FGACCELERATIONS_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include "models/FGModel.h"
42 #include "math/FGColumnVector3.h"
43 #include "math/LagrangeMultiplier.h"
44 #include "math/FGMatrix33.h"
45 
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 FORWARD DECLARATIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49 
50 namespace JSBSim {
51 
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 CLASS DOCUMENTATION
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55 
91 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 CLASS DECLARATION
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
94 
95 class FGAccelerations : public FGModel {
96 public:
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 
161  const FGColumnVector3& GetPQRdot(void) const {return vPQRdot;}
162 
176  const FGColumnVector3& GetPQRidot(void) const {return vPQRidot;}
177 
189  double GetUVWdot(int idx) const { return vUVWdot(idx); }
190 
203  const FGColumnVector3& GetBodyAccel(void) const { return vBodyAccel; }
204 
205  double GetGravAccelMagnitude(void) const { return in.vGravAccel.Magnitude(); }
206 
219  double GetBodyAccel(int idx) const { return vBodyAccel(idx); }
220 
233  double GetPQRdot(int axis) const {return vPQRdot(axis);}
234 
247  double GetMoments(int idx) const { return in.Moment(idx) + vFrictionMoments(idx); }
248  FGColumnVector3 GetMoments(void) const { return in.Moment + vFrictionMoments; }
249 
261  double GetForces(int idx) const { return in.Force(idx) + vFrictionForces(idx); }
262  FGColumnVector3 GetForces(void) const { return in.Force + vFrictionForces; }
263 
275  double GetGroundMoments(int idx) const { return in.GroundMoment(idx) + vFrictionMoments(idx); }
276  FGColumnVector3 GetGroundMoments(void) const { return in.GroundMoment + vFrictionMoments; }
277 
289  double GetGroundForces(int idx) const { return in.GroundForce(idx) + vFrictionForces(idx); }
290  FGColumnVector3 GetGroundForces(void) const { return in.GroundForce + vFrictionForces; }
291 
303  double GetWeight(int idx) const { return in.Mass * (in.Tec2b * in.vGravAccel)(idx); }
304  FGColumnVector3 GetWeight(void) const { return in.Mass * in.Tec2b * in.vGravAccel; }
305 
310  void InitializeDerivatives(void);
311 
316  void SetHoldDown(bool hd);
317 
318  struct Inputs {
356  double DeltaT;
358  double Mass;
360  std::vector<LagrangeMultiplier*> *MultipliersList;
361  } in;
362 
363 private:
364 
365  FGColumnVector3 vPQRdot, vPQRidot;
366  FGColumnVector3 vUVWdot, vUVWidot;
367  FGColumnVector3 vBodyAccel;
368  FGColumnVector3 vFrictionForces;
369  FGColumnVector3 vFrictionMoments;
370 
371  bool gravTorque;
372 
373  void CalculatePQRdot(void);
374  void CalculateUVWdot(void);
375 
376  void CalculateFrictionForces(double dt);
377 
378  void bind(void);
379  void Debug(int from) override;
380 };
381 }
382 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
383 #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.
double GetGroundMoments(int idx) const
Retrieves the ground moments applied on the body.
double GetMoments(int idx) const
Retrieves a component of the total moments applied on the body.
FGAccelerations(FGFDMExec *Executive)
Constructor.
bool Run(bool Holding) override
Runs the state propagation model; called by the Executive Can pass in a value indicating if the execu...
const FGColumnVector3 & GetPQRdot(void) const
Retrieves the body axis angular acceleration vector.
double GetPQRdot(int axis) const
Retrieves a body frame angular acceleration component.
const FGColumnVector3 & GetPQRidot(void) const
Retrieves the axis angular acceleration vector in the ECI frame.
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 & GetUVWdot(void) const
Retrieves the body axis acceleration.
const FGColumnVector3 & GetBodyAccel(void) const
Retrieves the acceleration resulting from the applied forces.
const FGColumnVector3 & GetUVWidot(void) const
Retrieves the body axis acceleration 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.