JSBSim Flight Dynamics Model  1.0 (02 March 2017)
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 Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  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 with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be found on
24  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 <vector>
42 
43 #include "models/FGModel.h"
44 #include "math/FGColumnVector3.h"
45 #include "math/LagrangeMultiplier.h"
46 #include "math/FGMatrix33.h"
47 
48 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49 DEFINITIONS
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
51 
52 #define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.20 2016/05/22 10:28:23 bcoconni Exp $"
53 
54 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 FORWARD DECLARATIONS
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
57 
58 namespace JSBSim {
59 
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 CLASS DOCUMENTATION
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63 
102 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
103 CLASS DECLARATION
104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
105 
106 class FGAccelerations : public FGModel {
107 public:
110  FGAccelerations(FGFDMExec* Executive);
111 
114 
116  enum eGravType {
121  };
122 
126  bool InitModel(void);
127 
135  bool Run(bool Holding);
136 
149  const FGColumnVector3& GetUVWdot(void) const { return vUVWdot; }
150 
165  const FGColumnVector3& GetUVWidot(void) const { return vUVWidot; }
166 
180  const FGColumnVector3& GetPQRdot(void) const {return vPQRdot;}
181 
195  const FGColumnVector3& GetPQRidot(void) const {return vPQRidot;}
196 
208  double GetUVWdot(int idx) const { return vUVWdot(idx); }
209 
222  const FGColumnVector3& GetBodyAccel(void) const { return vBodyAccel; }
223 
224  const FGColumnVector3& GetGravAccel(void) const {return vGravAccel; }
225 
226  double GetGravAccelMagnitude(void) const { return vGravAccel.Magnitude(); }
227 
240  double GetBodyAccel(int idx) const { return vBodyAccel(idx); }
241 
254  double GetPQRdot(int axis) const {return vPQRdot(axis);}
255 
268  double GetMoments(int idx) const { return in.Moment(idx) + vFrictionMoments(idx); }
269  FGColumnVector3 GetMoments(void) const { return in.Moment + vFrictionMoments; }
270 
282  double GetForces(int idx) const { return in.Force(idx) + vFrictionForces(idx); }
283  FGColumnVector3 GetForces(void) const { return in.Force + vFrictionForces; }
284 
296  double GetGroundMoments(int idx) const { return in.GroundMoment(idx) + vFrictionMoments(idx); }
297  FGColumnVector3 GetGroundMoments(void) const { return in.GroundMoment + vFrictionMoments; }
298 
310  double GetGroundForces(int idx) const { return in.GroundForce(idx) + vFrictionForces(idx); }
311  FGColumnVector3 GetGroundForces(void) const { return in.GroundForce + vFrictionForces; }
312 
324  double GetWeight(int idx) const { return in.Mass * (in.Ti2b * vGravAccel)(idx); }
325  FGColumnVector3 GetWeight(void) const { return in.Mass * in.Ti2b * vGravAccel; }
326 
331  void InitializeDerivatives(void);
332 
337  void SetHoldDown(bool hd);
338 
339  struct Inputs {
377  double DeltaT;
379  double Mass;
381  double GAccel;
383  std::vector<LagrangeMultiplier*> *MultipliersList;
384  } in;
385 
386 private:
387 
388  FGColumnVector3 vPQRdot, vPQRidot;
389  FGColumnVector3 vUVWdot, vUVWidot;
390  FGColumnVector3 vBodyAccel;
391  FGColumnVector3 vGravAccel;
392  FGColumnVector3 vFrictionForces;
393  FGColumnVector3 vFrictionMoments;
394 
395  int gravType;
396  bool gravTorque;
397 
398  void CalculatePQRdot(void);
399  void CalculateUVWdot(void);
400 
401  void ResolveFrictionForces(double dt);
402 
403  void bind(void);
404  void Debug(int from);
405 };
406 }
407 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
408 #endif
FGColumnVector3 TerrainAngularVel
Terrain angular velocities with respect to the local frame (expressed in the ECEF frame)...
FGMatrix33 Jinv
The inverse of the inertia matrix J.
const FGColumnVector3 & GetBodyAccel(void) const
Retrieves the acceleration resulting from the applied forces.
bool Run(bool Holding)
Runs the state propagation model; called by the Executive Can pass in a value indicating if the execu...
double GetGroundMoments(int idx) const
Retrieves the ground moments applied on the body.
FGMatrix33 Ti2b
Transformation matrix from the ECI to the Body frame.
FGColumnVector3 vPQRi
Angular velocities of the body with respect to the ECI frame (expressed in the body frame)...
FGColumnVector3 TerrainVelocity
Terrain velocities with respect to the local frame (expressed in the ECEF frame). ...
std::vector< LagrangeMultiplier * > * MultipliersList
List of Lagrange multipliers set by FGLGear for friction forces calculations.
FGColumnVector3 Force
Total forces applied to the body except friction and gravity (expressed in the body frame) ...
Evaluate gravity using WGS84 formulas that take the Earth oblateness into account.
const FGColumnVector3 & GetPQRidot(void) const
Retrieves the axis angular acceleration vector in the ECI frame.
const FGColumnVector3 & GetUVWdot(void) const
Retrieves the body axis acceleration.
FGColumnVector3 vOmegaPlanet
Earth rotating vector (expressed in the ECI frame).
double GetForces(int idx) const
Retrieves the total forces applied on the body.
FGColumnVector3 vUVW
Velocities of the body with respect to the local frame (expressed in the body frame).
FGAccelerations(FGFDMExec *Executive)
Constructor.
FGColumnVector3 vPQR
Angular velocities of the body with respect to the local frame (expressed in the body frame)...
FGColumnVector3 Moment
Total moments applied to the body except friction and gravity (expressed in the body frame) ...
FGColumnVector3 GroundForce
Forces generated by the ground normal reactions expressed in the body frame. Does not account for fri...
void InitializeDerivatives(void)
Initializes the FGAccelerations class prior to a new execution.
FGColumnVector3 vInertialPosition
Body position (X,Y,Z) measured in the ECI frame.
const FGColumnVector3 & GetUVWidot(void) const
Retrieves the body axis acceleration in the ECI frame.
double GAccel
Gravity intensity assuming the Earth is spherical.
Base class for all scheduled JSBSim models.
Definition: FGModel.h:74
double GetMoments(int idx) const
Retrieves a component of the total moments applied on the body.
double GetUVWdot(int idx) const
Retrieves a body frame acceleration component.
This class implements a 3 element column vector.
FGColumnVector3 J2Grav
Gravity intensity vector using WGS84 formulas (expressed in the ECEF frame).
FGMatrix33 Tec2i
Transformation matrix from the ECEF to the ECI frame.
FGColumnVector3 GroundMoment
Moments generated by the ground normal reactions expressed in the body frame. Does not account for fr...
bool InitModel(void)
Initializes the FGAccelerations class after instantiation and prior to first execution.
double GetWeight(int idx) const
Retrieves the weight applied on the body.
FGMatrix33 J
The body inertia matrix expressed in the body frame.
Evaluate gravity using Newton&#39;s classical formula assuming the Earth is spherical.
eGravType
These define the indices use to select the gravitation models.
Handles the calculation of accelerations.
double GetBodyAccel(int idx) const
Retrieves a component of the acceleration resulting from the applied forces.
FGMatrix33 Tec2b
Transformation matrix from the ECEF to the Body frame.
Handles matrix math operations.
Definition: FGMatrix33.h:92
double GetGroundForces(int idx) const
Retrieves the ground forces applied on the body.
double Magnitude(void) const
Length of the vector.
const FGColumnVector3 & GetPQRdot(void) const
Retrieves the body axis angular acceleration vector.
~FGAccelerations()
Destructor.
void SetHoldDown(bool hd)
Sets the property forces/hold-down.
double GetPQRdot(int axis) const
Retrieves a body frame angular acceleration component.
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
FGMatrix33 Tb2i
Transformation matrix from the Body to the ECI frame.