122 lines
4.3 KiB
C++
122 lines
4.3 KiB
C++
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
Header: FGInertial.h
|
|
Author: Jon S. Berndt
|
|
Date started: 09/13/00
|
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU Lesser General Public License as published by the Free Software
|
|
Foundation; either version 2 of the License, or (at your option) any later
|
|
version.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License along with
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
Further information about the GNU Lesser General Public License can also be found on
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
HISTORY
|
|
--------------------------------------------------------------------------------
|
|
09/13/00 JSB Created
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
SENTRY
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
#ifndef FGINERTIAL_H
|
|
#define FGINERTIAL_H
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
INCLUDES
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
#include <vector>
|
|
|
|
#include "FGModel.h"
|
|
#include "math/FGColumnVector3.h"
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
DEFINITIONS
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
#define ID_INERTIAL "$Id: FGInertial.h,v 1.22 2013/11/30 21:22:08 jberndt Exp $"
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
FORWARD DECLARATIONS
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
namespace JSBSim {
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
CLASS DOCUMENTATION
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
/** Models inertial forces (e.g. centripetal and coriolis accelerations). Starting
|
|
conversion to WGS84.
|
|
*/
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
CLASS DECLARATION
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
class FGInertial : public FGModel {
|
|
|
|
public:
|
|
FGInertial(FGFDMExec*);
|
|
~FGInertial(void);
|
|
|
|
bool InitModel(void);
|
|
|
|
/** Runs the Inertial model; called by the Executive
|
|
Can pass in a value indicating if the executive is directing the simulation to Hold.
|
|
@param Holding if 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.
|
|
@return false if no error */
|
|
bool Run(bool Holding);
|
|
double SLgravity(void) const {return gAccelReference;}
|
|
double gravity(void) const {return gAccel;}
|
|
double omega(void) const {return RotationRate;}
|
|
const FGColumnVector3& GetOmegaPlanet() const {return vOmegaPlanet;}
|
|
void SetOmegaPlanet(double rate) {
|
|
RotationRate = rate;
|
|
vOmegaPlanet = FGColumnVector3( 0.0, 0.0, RotationRate );
|
|
}
|
|
double GetGAccel(double r) const;
|
|
FGColumnVector3 GetGravityJ2(const FGColumnVector3& position) const;
|
|
double GetRefRadius(void) const {return RadiusReference;}
|
|
double GetSemimajor(void) const {return a;}
|
|
double GetSemiminor(void) const {return b;}
|
|
|
|
struct Inputs {
|
|
double Radius;
|
|
double Latitude;
|
|
} in;
|
|
|
|
private:
|
|
FGColumnVector3 vOmegaPlanet;
|
|
double gAccel;
|
|
double gAccelReference;
|
|
double RadiusReference;
|
|
double RotationRate;
|
|
double GM;
|
|
double C2_0; // WGS84 value for the C2,0 coefficient
|
|
double J2; // WGS84 value for J2
|
|
double a; // WGS84 semimajor axis length in feet
|
|
double b; // WGS84 semiminor axis length in feet
|
|
|
|
void bind(void);
|
|
void Debug(int from);
|
|
};
|
|
}
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
#endif
|