JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++

FGAccelerations Class Reference

Handles the calculation of accelerations. More...

#include <FGAccelerations.h>

Inheritance diagram for FGAccelerations:
Collaboration diagram for FGAccelerations:

List of all members.

Classes

struct  Inputs

Public Types

enum  eGravType { gtStandard, gtWGS84 }
 

These define the indices use to select the gravitation models.

More...

Public Member Functions

 FGAccelerations (FGFDMExec *Executive)
 Constructor.
 ~FGAccelerations ()
 Destructor.
const FGColumnVector3GetBodyAccel (void) const
 Retrieves the acceleration resulting from the applied forces.
double GetBodyAccel (int idx) const
 Retrieves a component of the acceleration resulting from the applied forces.
double GetForces (int idx) const
 Retrieves the total forces applied on the body.
const FGColumnVector3GetGravAccel (void) const
double GetGroundForces (int idx) const
 Retrieves the ground forces applied on the body.
double GetGroundMoments (int idx) const
 Retrieves the ground moments applied on the body.
int GetHoldDown (void) const
 Gets the value of the property forces/hold-down.
double GetMoments (int idx) const
 Retrieves a component of the total moments applied on the body.
const FGColumnVector3GetPQRdot (void) const
 Retrieves the body axis angular acceleration vector.
double GetPQRdot (int axis) const
 Retrieves a body frame angular acceleration component.
const FGColumnVector3GetPQRidot (void) const
 Retrieves the axis angular acceleration vector in the ECI frame.
const FGQuaternionGetQuaterniondot (void) const
 Retrieves the time derivative of the body orientation quaternion.
double GetUVWdot (int idx) const
 Retrieves a body frame acceleration component.
const FGColumnVector3GetUVWdot (void) const
 Retrieves the body axis acceleration.
const FGColumnVector3GetUVWidot (void) const
 Retrieves the body axis acceleration in the ECI frame.
void InitializeDerivatives (void)
 Initializes the FGAccelerations class prior to a new execution.
bool InitModel (void)
 Initializes the FGAccelerations class after instantiation and prior to first execution.
bool Run (bool Holding)
 Runs the state propagation model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold.
void SetHoldDown (int hd)
 Sets the property forces/hold-down.

Public Attributes

struct
JSBSim::FGAccelerations::Inputs 
in

Detailed Description

  • Calculate the angular accelerations
  • Calculate the translational accelerations
  • Calculate the angular rate
  • Calculate the translational velocity

This class is collecting all the forces and the moments acting on the body to calculate the corresponding accelerations according to Newton's second law. This is also where the friction forces related to the ground reactions are evaluated.

JSBSim provides several ways to calculate the influence of the gravity on the vehicle. The different options can be selected via the following properties :

  • simulation/gravity-model (read/write) Selects the gravity model. Two options are available : 0 (Standard gravity assuming the Earth is spherical) or 1 (WGS84 gravity taking the Earth oblateness into account). WGS84 gravity is the default.
  • simulation/gravitational-torque (read/write) Enables/disables the calculations of the gravitational torque on the vehicle. This is mainly relevant for spacecrafts that are orbiting at low altitudes. Gravitational torque calculations are disabled by default.

Special care is taken in the calculations to obtain maximum fidelity in JSBSim results. In FGAccelerations, this is obtained by avoiding as much as possible the transformations from one frame to another. As a consequence, the frames in which the accelerations are primarily evaluated are dictated by the frames in which FGPropagate resolves the equations of movement (the ECI frame for the translations and the body frame for the rotations).

See also:
Mark Harris and Robert Lyle, "Spacecraft Gravitational Torques", NASA SP-8024, May 1969
Author:
Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
Version:
Id:
FGAccelerations.h,v 1.14 2012/09/25 12:44:36 jberndt Exp

Definition at line 107 of file FGAccelerations.h.


Member Enumeration Documentation

enum eGravType
Enumerator:
gtStandard 

Evaluate gravity using Newton's classical formula assuming the Earth is spherical.

gtWGS84 

Evaluate gravity using WGS84 formulas that take the Earth oblateness into account.

Definition at line 117 of file FGAccelerations.h.


Constructor & Destructor Documentation

FGAccelerations ( FGFDMExec Executive)
Parameters:
Executivea pointer to the parent executive object

Definition at line 70 of file FGAccelerations.cpp.

References FGAccelerations::gtWGS84.

  : FGModel(fdmex)
{
  Debug(0);
  Name = "FGAccelerations";
  gravType = gtWGS84;
  gravTorque = false;
  HoldDown = 0;

  vPQRidot.InitMatrix();
  vUVWidot.InitMatrix();
  vGravAccel.InitMatrix();
  vBodyAccel.InitMatrix();
  vQtrndot = FGQuaternion(0,0,0);

  bind();
  Debug(0);
}

Member Function Documentation

const FGColumnVector3& GetBodyAccel ( void  ) const [inline]

Retrieves the ratio of the sum of all forces applied on the craft to its mass. This does include the friction forces but not the gravity. The vector returned is represented by an FGColumnVector3 reference. The vector for the acceleration in Body frame is organized (Ax, Ay, Az). The vector is 1-based, so that the first element can be retrieved using the "()" operator. In other words, vBodyAccel(1) is Ax. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the vector returned by this call are, eX=1, eY=2, eZ=3. units ft/sec^2

Returns:
The acceleration resulting from the applied forces.

Definition at line 234 of file FGAccelerations.h.

{ return vBodyAccel; }
double GetBodyAccel ( int  idx) const [inline]

Retrieves a component of the ratio between the sum of all forces applied on the craft to its mass. The value returned is extracted from the vBodyAccel vector (an FGColumnVector3). The vector for the acceleration in Body frame is organized (Ax, Ay, Az). The vector is 1-based. In other words, GetBodyAccel(1) returns Ax. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the vector returned by this call are, eX=1, eY=2, eZ=3. units ft/sec^2

Parameters:
idxthe index of the acceleration component desired (1-based).
Returns:
The component of the acceleration resulting from the applied forces.

Definition at line 250 of file FGAccelerations.h.

{ return vBodyAccel(idx); }
double GetForces ( int  idx) const [inline]

Retrieves the total forces applied on the body. This does include the friction forces but not the gravity. The vector for the total forces in the body frame is organized (Fx, Fy , Fz). The vector is 1-based. In other words, GetForces(1) returns Fx. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the forces returned by this call are, eX=1, eY=2, eZ=3. units lbs

Parameters:
idxthe index of the forces component desired (1-based).
Returns:
The total forces applied on the body.

Definition at line 291 of file FGAccelerations.h.

References FGAccelerations::Inputs::Force.

{ return in.Force(idx) + vFrictionForces(idx); }
double GetGroundForces ( int  idx) const [inline]

Retrieves the ground forces applied on the body. This does include the ground normal reaction and friction forces. The vector for the total moments in the body frame is organized (Fx, Fy , Fz). The vector is 1-based. In other words, GetGroundForces(1) returns Fx. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the forces returned by this call are, eX=1, eY=2, eZ=3. units lbs

Parameters:
idxthe index of the forces component desired (1-based).
Returns:
The ground forces applied on the body.

Definition at line 317 of file FGAccelerations.h.

References FGAccelerations::Inputs::GroundForce.

{ return in.GroundForce(idx) + vFrictionForces(idx); }
double GetGroundMoments ( int  idx) const [inline]

Retrieves the ground moments applied on the body. This does include the ground normal reaction and friction moments. The vector for the ground moments in the body frame is organized (Mx, My , Mz). The vector is 1-based. In other words, GetGroundMoments(1) returns Mx. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the moments returned by this call are, eX=1, eY=2, eZ=3. units lbs*ft

Parameters:
idxthe index of the moments component desired (1-based).
Returns:
The ground moments applied on the body.

Definition at line 304 of file FGAccelerations.h.

References FGAccelerations::Inputs::GroundMoment.

{ return in.GroundMoment(idx) + vFrictionMoments(idx); }
int GetHoldDown ( void  ) const [inline]
Returns:
zero if the 'hold-down' function is disabled, non-zero otherwise.

Definition at line 333 of file FGAccelerations.h.

{return HoldDown;}
double GetMoments ( int  idx) const [inline]

Retrieves a component of the total moments applied on the body. This does include the moments generated by friction forces and the gravitational torque (if the property simulation/gravitational-torque is set to true). The vector for the total moments in the body frame is organized (Mx, My , Mz). The vector is 1-based. In other words, GetMoments(1) returns Mx. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the moments returned by this call are, eX=1, eY=2, eZ=3. units lbs*ft

Parameters:
idxthe index of the moments component desired (1-based).
Returns:
The total moments applied on the body.

Definition at line 278 of file FGAccelerations.h.

References FGAccelerations::Inputs::Moment.

{ return in.Moment(idx) + vFrictionMoments(idx); }
const FGColumnVector3& GetPQRdot ( void  ) const [inline]

Retrieves the body axis angular acceleration vector in rad/sec^2. The angular acceleration vector is determined from the applied moments and accounts for a rotating frame. The vector returned is represented by an FGColumnVector3 reference. The vector for the angular acceleration in Body frame is organized (Pdot, Qdot, Rdot). The vector is 1-based, so that the first element can be retrieved using the "()" operator. In other words, vPQRdot(1) is Pdot. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the vector returned by this call are, eP=1, eQ=2, eR=3. units rad/sec^2

Returns:
The angular acceleration vector.

Definition at line 192 of file FGAccelerations.h.

Referenced by FGOutputSocket::Print().

{return vPQRdot;}

Here is the caller graph for this function:

double GetPQRdot ( int  axis) const [inline]

Retrieves a body frame angular acceleration component. The angular acceleration returned is extracted from the vPQRdot vector (an FGColumnVector3). The vector for the angular acceleration in Body frame is organized (Pdot, Qdot, Rdot). The vector is 1-based. In other words, GetPQRdot(1) returns Pdot (roll acceleration). Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the angular acceleration returned by this call are, eP=1, eQ=2, eR=3. units rad/sec^2

Parameters:
axisthe index of the angular acceleration component desired (1-based).
Returns:
The body frame angular acceleration component.

Definition at line 264 of file FGAccelerations.h.

{return vPQRdot(axis);}
const FGColumnVector3& GetPQRidot ( void  ) const [inline]

Retrieves the body axis angular acceleration vector measured in the ECI frame and expressed in the body frame. The angular acceleration vector is determined from the applied moments. The vector returned is represented by an FGColumnVector3 reference. The vector for the angular acceleration in Body frame is organized (Pidot, Qidot, Ridot). The vector is 1-based, so that the first element can be retrieved using the "()" operator. In other words, vPQRidot(1) is Pidot. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the vector returned by this call are, eP=1, eQ=2, eR=3. units rad/sec^2

Returns:
The angular acceleration vector.

Definition at line 207 of file FGAccelerations.h.

{return vPQRidot;}
const FGQuaternion& GetQuaterniondot ( void  ) const [inline]

Retrieves the time derivative of the body orientation quaternion based on the rate of change of the orientation between the body and the ECI frame. The quaternion returned is represented by an FGQuaternion reference. The quaternion is 1-based, so that the first element can be retrieved using the "()" operator. units rad/sec^2

Returns:
The time derivative of the body orientation quaternion.

Definition at line 147 of file FGAccelerations.h.

{return vQtrndot;}
const FGColumnVector3& GetUVWdot ( void  ) const [inline]

Retrieves the computed body axis accelerations based on the applied forces and accounting for a rotating body frame. The vector returned is represented by an FGColumnVector3 reference. The vector for the acceleration in Body frame is organized (Ax, Ay, Az). The vector is 1-based, so that the first element can be retrieved using the "()" operator. In other words, vUVWdot(1) is Ax. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the vector returned by this call are, eX=1, eY=2, eZ=3. units ft/sec^2

Returns:
Body axis translational acceleration in ft/sec^2.

Definition at line 161 of file FGAccelerations.h.

{ return vUVWdot; }
double GetUVWdot ( int  idx) const [inline]

Retrieves a body frame acceleration component. The acceleration returned is extracted from the vUVWdot vector (an FGColumnVector3). The vector for the acceleration in Body frame is organized (Ax, Ay, Az). The vector is 1-based. In other words, GetUVWdot(1) returns Ax. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the acceleration returned by this call are, eX=1, eY=2, eZ=3. units ft/sec^2

Parameters:
idxthe index of the acceleration component desired (1-based).
Returns:
The body frame acceleration component.

Definition at line 220 of file FGAccelerations.h.

{ return vUVWdot(idx); }
const FGColumnVector3& GetUVWidot ( void  ) const [inline]

Retrieves the computed body axis accelerations based on the applied forces. The ECI frame being an inertial frame this vector does not contain the Coriolis and centripetal accelerations. The vector is expressed in the Body frame. The vector returned is represented by an FGColumnVector3 reference. The vector for the acceleration in Body frame is organized (Aix, Aiy, Aiz). The vector is 1-based, so that the first element can be retrieved using the "()" operator. In other words, vUVWidot(1) is Aix. Various convenience enumerators are defined in FGJSBBase. The relevant enumerators for the vector returned by this call are, eX=1, eY=2, eZ=3. units ft/sec^2

Returns:
Body axis translational acceleration in ft/sec^2.

Definition at line 177 of file FGAccelerations.h.

{ return vUVWidot; }
void InitializeDerivatives ( void  )

Initializes the class prior to a new execution when the input data stored in the Inputs structure have been set to their initial values.

Definition at line 344 of file FGAccelerations.cpp.

{
  // Make an initial run and set past values
  CalculatePQRdot();           // Angular rate derivative
  CalculateUVWdot();           // Translational rate derivative
  CalculateQuatdot();          // Angular orientation derivative
  ResolveFrictionForces(0.);   // Update rate derivatives with friction forces
}
bool InitModel ( void  ) [virtual]

The base class FGModel::InitModel is called first, initializing pointers to the other FGModel objects (and others).

Reimplemented from FGModel.

Definition at line 98 of file FGAccelerations.cpp.

{
  vPQRidot.InitMatrix();
  vUVWidot.InitMatrix();
  vGravAccel.InitMatrix();
  vBodyAccel.InitMatrix();
  vQtrndot = FGQuaternion(0,0,0);

  return true;
}
bool Run ( bool  Holding) [virtual]
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 114 of file FGAccelerations.cpp.

References FGAccelerations::Inputs::DeltaT, and FGModel::Run().

Referenced by FGFDMExec::Initialize().

{
  if (FGModel::Run(Holding)) return true;  // Fast return if we have nothing to do ...
  if (Holding) return false;

  CalculatePQRdot();   // Angular rate derivative
  CalculateUVWdot();   // Translational rate derivative
  CalculateQuatdot();  // Angular orientation derivative

  ResolveFrictionForces(in.DeltaT * rate);  // Update rate derivatives with friction forces

  Debug(2);
  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void SetHoldDown ( int  hd) [inline]

This allows to do hard 'hold-down' such as for rockets on a launch pad with engines ignited.

Parameters:
hdenables the 'hold-down' function if non-zero

Definition at line 329 of file FGAccelerations.h.

{HoldDown = hd;}

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