JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
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
JSBSim::FGFDMExec
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:185
JSBSim::FGAccelerations::GetUVWdot
const FGColumnVector3 & GetUVWdot(void) const
Retrieves the body axis acceleration.
Definition: FGAccelerations.h:130
JSBSim::FGAccelerations::Inputs::Tb2i
FGMatrix33 Tb2i
Transformation matrix from the Body to the ECI frame.
Definition: FGAccelerations.h:326
JSBSim::FGAccelerations::Inputs::Tec2b
FGMatrix33 Tec2b
Transformation matrix from the ECEF to the Body frame.
Definition: FGAccelerations.h:328
JSBSim::FGColumnVector3
This class implements a 3 element column vector.
Definition: FGColumnVector3.h:63
JSBSim::FGModel
Base class for all scheduled JSBSim models.
Definition: FGModel.h:68
JSBSim::FGAccelerations::Inputs::vUVW
FGColumnVector3 vUVW
Velocities of the body with respect to the local frame (expressed in the body frame).
Definition: FGAccelerations.h:346
JSBSim::FGAccelerations::SetHoldDown
void SetHoldDown(bool hd)
Sets the property forces/hold-down.
Definition: FGAccelerations.cpp:209
JSBSim::FGAccelerations::Inputs::vOmegaPlanet
FGColumnVector3 vOmegaPlanet
Earth rotating vector (expressed in the ECI frame).
Definition: FGAccelerations.h:350
JSBSim::FGAccelerations::Inputs::TerrainAngularVel
FGColumnVector3 TerrainAngularVel
Terrain angular velocities with respect to the local frame (expressed in the ECEF frame).
Definition: FGAccelerations.h:354
JSBSim::FGAccelerations::GetUVWidot
const FGColumnVector3 & GetUVWidot(void) const
Retrieves the body axis acceleration in the ECI frame.
Definition: FGAccelerations.h:146
JSBSim::FGAccelerations::Inputs::Jinv
FGMatrix33 Jinv
The inverse of the inertia matrix J.
Definition: FGAccelerations.h:322
JSBSim::FGAccelerations::Inputs::GroundMoment
FGColumnVector3 GroundMoment
Moments generated by the ground normal reactions expressed in the body frame. Does not account for fr...
Definition: FGAccelerations.h:334
JSBSim::FGAccelerations::Inputs::GroundForce
FGColumnVector3 GroundForce
Forces generated by the ground normal reactions expressed in the body frame. Does not account for fri...
Definition: FGAccelerations.h:338
JSBSim::FGAccelerations::GetGroundMoments
double GetGroundMoments(int idx) const
Retrieves the ground moments applied on the body.
Definition: FGAccelerations.h:275
JSBSim::FGAccelerations::Inputs::TerrainVelocity
FGColumnVector3 TerrainVelocity
Terrain velocities with respect to the local frame (expressed in the ECEF frame).
Definition: FGAccelerations.h:352
JSBSim::FGMatrix33
Handles matrix math operations.
Definition: FGMatrix33.h:69
JSBSim::FGAccelerations::Inputs::Moment
FGColumnVector3 Moment
Total moments applied to the body except friction and gravity (expressed in the body frame)
Definition: FGAccelerations.h:332
JSBSim::FGColumnVector3::Magnitude
double Magnitude(void) const
Length of the vector.
Definition: FGColumnVector3.cpp:109
JSBSim::FGAccelerations::Run
bool Run(bool Holding) override
Runs the state propagation model; called by the Executive Can pass in a value indicating if the execu...
Definition: FGAccelerations.cpp:109
JSBSim::FGAccelerations::Inputs::Ti2b
FGMatrix33 Ti2b
Transformation matrix from the ECI to the Body frame.
Definition: FGAccelerations.h:324
JSBSim::FGAccelerations::Inputs::Force
FGColumnVector3 Force
Total forces applied to the body except friction and gravity (expressed in the body frame)
Definition: FGAccelerations.h:336
JSBSim::FGAccelerations::Inputs::Tec2i
FGMatrix33 Tec2i
Transformation matrix from the ECEF to the ECI frame.
Definition: FGAccelerations.h:330
JSBSim::FGAccelerations::GetForces
double GetForces(int idx) const
Retrieves the total forces applied on the body.
Definition: FGAccelerations.h:261
JSBSim::FGAccelerations::Inputs::J
FGMatrix33 J
The body inertia matrix expressed in the body frame.
Definition: FGAccelerations.h:320
JSBSim::FGAccelerations::GetPQRidot
const FGColumnVector3 & GetPQRidot(void) const
Retrieves the axis angular acceleration vector in the ECI frame.
Definition: FGAccelerations.h:176
JSBSim::FGAccelerations
Handles the calculation of accelerations.
Definition: FGAccelerations.h:95
JSBSim::FGAccelerations::Inputs::vGravAccel
FGColumnVector3 vGravAccel
Gravity intensity vector (expressed in the ECEF frame).
Definition: FGAccelerations.h:340
JSBSim::FGAccelerations::Inputs::Mass
double Mass
Body mass.
Definition: FGAccelerations.h:358
JSBSim::FGAccelerations::GetMoments
double GetMoments(int idx) const
Retrieves a component of the total moments applied on the body.
Definition: FGAccelerations.h:247
JSBSim::FGAccelerations::GetUVWdot
double GetUVWdot(int idx) const
Retrieves a body frame acceleration component.
Definition: FGAccelerations.h:189
JSBSim::FGAccelerations::Inputs::vInertialPosition
FGColumnVector3 vInertialPosition
Body position (X,Y,Z) measured in the ECI frame.
Definition: FGAccelerations.h:348
JSBSim::FGAccelerations::GetBodyAccel
const FGColumnVector3 & GetBodyAccel(void) const
Retrieves the acceleration resulting from the applied forces.
Definition: FGAccelerations.h:203
JSBSim::FGAccelerations::InitializeDerivatives
void InitializeDerivatives(void)
Initializes the FGAccelerations class prior to a new execution.
Definition: FGAccelerations.cpp:334
JSBSim::FGAccelerations::~FGAccelerations
~FGAccelerations()
Destructor.
Definition: FGAccelerations.cpp:85
JSBSim::FGAccelerations::Inputs::vPQR
FGColumnVector3 vPQR
Angular velocities of the body with respect to the local frame (expressed in the body frame).
Definition: FGAccelerations.h:344
JSBSim::FGAccelerations::GetWeight
double GetWeight(int idx) const
Retrieves the weight applied on the body.
Definition: FGAccelerations.h:303
JSBSim::FGAccelerations::FGAccelerations
FGAccelerations(FGFDMExec *Executive)
Constructor.
Definition: FGAccelerations.cpp:67
JSBSim::FGAccelerations::InitModel
bool InitModel(void) override
Initializes the FGAccelerations class after instantiation and prior to first execution.
Definition: FGAccelerations.cpp:92
JSBSim::FGAccelerations::Inputs
Definition: FGAccelerations.h:318
JSBSim::FGAccelerations::GetPQRdot
const FGColumnVector3 & GetPQRdot(void) const
Retrieves the body axis angular acceleration vector.
Definition: FGAccelerations.h:161
JSBSim::FGAccelerations::GetBodyAccel
double GetBodyAccel(int idx) const
Retrieves a component of the acceleration resulting from the applied forces.
Definition: FGAccelerations.h:219
JSBSim::FGAccelerations::GetGroundForces
double GetGroundForces(int idx) const
Retrieves the ground forces applied on the body.
Definition: FGAccelerations.h:289
JSBSim::FGAccelerations::Inputs::MultipliersList
std::vector< LagrangeMultiplier * > * MultipliersList
List of Lagrange multipliers set by FGLGear for friction forces calculations.
Definition: FGAccelerations.h:360
JSBSim::FGAccelerations::Inputs::vPQRi
FGColumnVector3 vPQRi
Angular velocities of the body with respect to the ECI frame (expressed in the body frame).
Definition: FGAccelerations.h:342
JSBSim::FGAccelerations::Inputs::DeltaT
double DeltaT
Time step.
Definition: FGAccelerations.h:356
JSBSim::FGAccelerations::GetPQRdot
double GetPQRdot(int axis) const
Retrieves a body frame angular acceleration component.
Definition: FGAccelerations.h:233