FDMExec.GetAircraft()->GetXYZcg()(2),
FDMExec.GetAircraft()->GetXYZcg()(3) );
+
+ set_Accels_Local( FDMExec.GetPosition()->GetVelDot()(1),
+ FDMExec.GetPosition()->GetVelDot()(2),
+ FDMExec.GetPosition()->GetVelDot()(3) );
+
set_Accels_Body ( FDMExec.GetTranslation()->GetUVWdot()(1),
FDMExec.GetTranslation()->GetUVWdot()(2),
FDMExec.GetTranslation()->GetUVWdot()(3) );
FDMExec.GetTranslation()->GetUVWdot()(2),
FDMExec.GetTranslation()->GetUVWdot()(3) );
- set_Accels_CG_Body_N ( FDMExec.GetTranslation()->GetNcg()(1),
- FDMExec.GetTranslation()->GetNcg()(2),
- FDMExec.GetTranslation()->GetNcg()(3) );
+ //set_Accels_CG_Body_N ( FDMExec.GetTranslation()->GetNcg()(1),
+ // FDMExec.GetTranslation()->GetNcg()(2),
+ // FDMExec.GetTranslation()->GetNcg()(3) );
+ //
set_Accels_Pilot_Body( FDMExec.GetAuxiliary()->GetPilotAccel()(1),
FDMExec.GetAuxiliary()->GetPilotAccel()(2),
FDMExec.GetAuxiliary()->GetPilotAccel()(3) );
- set_Accels_Pilot_Body_N( FDMExec.GetAuxiliary()->GetNpilot()(1),
- FDMExec.GetAuxiliary()->GetNpilot()(2),
- FDMExec.GetAuxiliary()->GetNpilot()(3) );
+ //set_Accels_Pilot_Body_N( FDMExec.GetAuxiliary()->GetNpilot()(1),
+ // FDMExec.GetAuxiliary()->GetNpilot()(2),
+ // FDMExec.GetAuxiliary()->GetNpilot()(3) );
FDMExec.GetState()->GetParameter(FG_PITCHRATE),
FDMExec.GetState()->GetParameter(FG_YAWRATE) );
- /* HUH!?! */ set_Euler_Rates( FDMExec.GetRotation()->Getphi(),
- FDMExec.GetRotation()->Gettht(),
- FDMExec.GetRotation()->Getpsi() );
+ set_Euler_Rates( FDMExec.GetRotation()->GetEulerRates()(1),
+ FDMExec.GetRotation()->GetEulerRates()(2),
+ FDMExec.GetRotation()->GetEulerRates()(3) );
- // ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
+ set_Geocentric_Rates( FDMExec.GetPosition()->GetLatitudeDot(),
+ FDMExec.GetPosition()->GetLongitudeDot(),
+ FDMExec.GetPosition()->Gethdot() );
set_Mach_number( FDMExec.GetTranslation()->GetMach());
set_Alpha( FDMExec.GetTranslation()->Getalpha() );
set_Beta( FDMExec.GetTranslation()->Getbeta() );
-
+
+ set_Cos_phi( FDMExec.GetRotation()->GetCosphi() );
+ //set_Sin_phi ( FDMExec.GetRotation()->GetSinpphi() );
+
+ set_Cos_theta( FDMExec.GetRotation()->GetCostht() );
+ //set_Sin_theta ( FDMExec.GetRotation()->GetSintht() );
+
+ //set_Cos_psi( FDMExec.GetRotation()->GetCospsi() );
+ //set_Sin_psi ( FDMExec.GetRotation()->GetSinpsi() );
+
set_Gamma_vert_rad( FDMExec.GetPosition()->GetGamma() );
// set_Gamma_horiz_rad( Gamma_horiz_rad );
+
+ set_Density( FDMExec.GetAtmosphere()->GetDensity() );
+ set_Static_pressure( FDMExec.GetAtmosphere()->GetPressure() );
+ set_Static_temperature ( FDMExec.GetAtmosphere()->GetTemperature() );
+
+
+
/* **FIXME*** */ set_Sea_level_radius( sl_radius2 * METER_TO_FEET );
/* **FIXME*** */ set_Earth_position_angle( 0.0 );
FGPosition::FGPosition(FGFDMExec* fdmex) : FGModel(fdmex),
vUVW(3),
- vVel(3)
+ vVel(3),
+ vVelDot(3)
{
Name = "FGPosition";
LongitudeDot = LatitudeDot = RadiusDot = 0.0;
vUVW = Translation->GetUVW();
Vt = Translation->GetVt();
vVel = State->GetTb2l()*vUVW;
+ vVelDot = State->GetTb2l() * Translation->GetUVWdot();
b = Aircraft->GetWingSpan();
*******************************************************************************/
class FGPosition : public FGModel {
+
FGColumnVector vUVW;
FGColumnVector vVel;
-
+ FGColumnVector vVelDot;
+
double Vee, invMass, invRadius;
double Radius, h;
double LatitudeDot, LongitudeDot, RadiusDot;
~FGPosition(void);
inline FGColumnVector GetVel(void) { return vVel; }
+ inline FGColumnVector GetVelDot(void) { return vVelDot; }
inline FGColumnVector GetUVW(void) { return vUVW; }
inline double GetVn(void) { return vVel(eX); }
inline double GetVe(void) { return vVel(eY); }
inline double Geth(void) { return h; }
inline double Gethdot(void) { return RadiusDot; }
inline double GetLatitude(void) { return Latitude; }
+ inline double GetLatitudeDot(void) { return LatitudeDot; }
inline double GetLongitude(void) { return Longitude; }
+ inline double GetLongitudeDot(void) { return LongitudeDot; }
inline double GetRunwayRadius(void) { return RunwayRadius; }
inline double GetDistanceAGL(void) { return DistanceAGL; }
inline double GetGamma(void) { return gamma; }
vPQR(3),
vPQRdot(3),
vEuler(3),
+ vEulerRates(3),
vMoments(3)
{
Name = "FGRotation";
+ cTht=cPhi=cPsi=1.0;
+ sTht=sPhi=sPsi=0.0;
}
/******************************************************************************/
bool FGRotation::Run(void)
{
float L2, N1;
+ float tTheta;
static FGColumnVector vlastPQRdot(3);
if (!FGModel::Run()) {
State->IntegrateQuat(vPQR, rate);
State->CalcMatrices();
vEuler = State->CalcEuler();
-
+
+
+ cTht=cos(vEuler(eTht)); sTht=sin(vEuler(eTht));
+ cPhi=cos(vEuler(ePhi)); sPhi=sin(vEuler(ePhi));
+ cPsi=cos(vEuler(ePsi)); sPsi=sin(vEuler(ePsi));
+
+
+ vEulerRates(eTht) = vPQR(2)*cPhi - vPQR(3)*sPhi;
+ if(cTht != 0.0) {
+ tTheta=sTht/cTht; // what's cheaper: / or tan() ?
+ vEulerRates(ePhi) = vPQR(1) + (vPQR(2)*sPhi + vPQR(3)*cPhi)*tTheta;
+ vEulerRates(ePsi) = (vPQR(2)*sPhi + vPQR(3)*cPhi)/cTht;
+ }
+
vlastPQRdot = vPQRdot;
} else {
FGColumnVector vPQRdot;
FGColumnVector vMoments;
FGColumnVector vEuler;
-
+ FGColumnVector vEulerRates;
+
+ float cTht,sTht;
+ float cPhi,sPhi;
+ float cPsi,sPsi;
+
float Ixx, Iyy, Izz, Ixz;
float dt;
inline FGColumnVector GetPQR(void) {return vPQR;}
inline FGColumnVector GetPQRdot(void) {return vPQRdot;}
inline FGColumnVector GetEuler(void) {return vEuler;}
+ inline FGColumnVector GetEulerRates(void) { return vEulerRates; }
inline void SetPQR(FGColumnVector tt) {vPQR = tt;}
inline void SetEuler(FGColumnVector tt) {vEuler = tt;}
+
inline float Getphi(void) {return vEuler(1);}
inline float Gettht(void) {return vEuler(2);}
inline float Getpsi(void) {return vEuler(3);}
+
+ inline float GetCosphi(void) {return cPhi;}
+ inline float GetCostht(void) {return cTht;}
+ inline float GetCospsi(void) {return cPsi;}
+
+ inline float GetSinphi(void) {return sPhi;}
+ inline float GetSintht(void) {return sTht;}
+ inline float GetSinpsi(void) {return sPsi;}
+
+
+
};
/******************************************************************************/
}
FG_VECTOR_3 n_cg_body_v;
- inline double * get_N_cg_body_v() { return n_cg_body_v; }
- inline double get_N_X_cg() const { return n_cg_body_v[0]; }
- inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
- inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
- inline void set_Accels_CG_Body_N( double x, double y, double z ) {
- n_cg_body_v[0] = x;
- n_cg_body_v[1] = y;
- n_cg_body_v[2] = z;
- }
+ // inline double * get_N_cg_body_v() { return n_cg_body_v; }
+ // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
+ // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
+ // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
+ // inline void set_Accels_CG_Body_N( double x, double y, double z ) {
+ // n_cg_body_v[0] = x;
+ // n_cg_body_v[1] = y;
+ // n_cg_body_v[2] = z;
+ // }
FG_VECTOR_3 n_pilot_body_v;
// inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
- inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
- inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
- inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
- inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
- n_pilot_body_v[0] = x;
- n_pilot_body_v[1] = y;
- n_pilot_body_v[2] = z;
- }
+ // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
+ // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
+ // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
+ // inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
+ // n_pilot_body_v[0] = x;
+ // n_pilot_body_v[1] = y;
+ // n_pilot_body_v[2] = z;
+ // }
double nlf; //Normal Load Factor
double get_Nlf(void) { return nlf; }