38 #include "FGInertial.h" 39 #include "FGFDMExec.h" 46 IDENT(IdSrc,
"$Id: FGInertial.cpp,v 1.31 2014/05/17 15:24:37 jberndt Exp $");
47 IDENT(IdHdr,ID_INERTIAL);
54 FGInertial::FGInertial(FGFDMExec* fgex) : FGModel(fgex)
59 RotationRate = 0.00007292115;
61 GM = 14.0764417572E15;
62 C2_0 = -4.84165371736E-04;
80 vOmegaPlanet = FGColumnVector3( 0.0, 0.0, RotationRate );
81 gAccelReference = GM/(RadiusReference*RadiusReference);
82 gAccel = GM/(RadiusReference*RadiusReference);
91 FGInertial::~FGInertial(
void)
98 bool FGInertial::InitModel(
void)
100 return FGModel::InitModel();
109 if (Holding)
return false;
112 gAccel = GetGAccel(in.Radius);
119 double FGInertial::GetGAccel(
double r)
const 137 double sinLat = sin(in.Latitude);
140 double preCommon = 1.5*J2*adivr*adivr;
141 double xy = 1.0 - 5.0*(sinLat*sinLat);
142 double z = 3.0 - 5.0*(sinLat*sinLat);
143 double GMOverr2 = GM/(r*r);
145 J2Gravity(1) = -GMOverr2 * ((1.0 + (preCommon * xy)) * position(eX)/r);
146 J2Gravity(2) = -GMOverr2 * ((1.0 + (preCommon * xy)) * position(eY)/r);
147 J2Gravity(3) = -GMOverr2 * ((1.0 + (preCommon * z)) * position(eZ)/r);
154 void FGInertial::bind(
void)
156 PropertyManager->
Tie(
"inertial/sea-level-radius_ft",
this, &FGInertial::GetRefRadius);
178 void FGInertial::Debug(
int from)
180 if (debug_lvl <= 0)
return;
187 if (debug_lvl & 2 ) {
188 if (from == 0) cout <<
"Instantiated: FGInertial" << endl;
189 if (from == 1) cout <<
"Destroyed: FGInertial" << endl;
191 if (debug_lvl & 4 ) {
193 if (debug_lvl & 8 ) {
195 if (debug_lvl & 16) {
197 if (debug_lvl & 64) {
199 cout << IdSrc << endl;
200 cout << IdHdr << endl;
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
bool Run(bool Holding)
Runs the Inertial model; called by the Executive Can pass in a value indicating if the executive is d...
This class implements a 3 element column vector.
double Magnitude(void) const
Length of the vector.