--------------------------------------------------------------------------------
This class integrates the translational EOM.
-ARGUMENTS
---------------------------------------------------------------------------------
-
-
HISTORY
--------------------------------------------------------------------------------
12/02/98 JSB Created
*******************************************************************************/
#include "FGTranslation.h"
+#include "FGRotation.h"
+#include "FGAtmosphere.h"
+#include "FGState.h"
+#include "FGFDMExec.h"
+#include "FGFCS.h"
+#include "FGAircraft.h"
+#include "FGPosition.h"
+#include "FGAuxiliary.h"
+#include "FGOutput.h"
/*******************************************************************************
************************************ CODE **************************************
*******************************************************************************/
-FGTranslation::FGTranslation(void) : FGModel()
+FGTranslation::FGTranslation(FGFDMExec* fdmex) : FGModel(fdmex)
{
- strcpy(Name, "FGTranslation");
+ Name = "FGTranslation";
+ Udot = Vdot = Wdot = 0.0;
}
lastVdot = Vdot;
lastWdot = Wdot;
- Udot = V*R - W*Q + Fx/m;
- Vdot = W*P - U*R + Fy/m;
- Wdot = U*Q - V*P + Fz/m;
+ Udot = V*R - W*Q + Fx/Mass;
+ Vdot = W*P - U*R + Fy/Mass;
+ Wdot = U*Q - V*P + Fz/Mass;
- U += 0.5*dt*(lastUdot + Udot);
- V += 0.5*dt*(lastVdot + Vdot);
- W += 0.5*dt*(lastWdot + Wdot);
+ U += 0.5*dt*rate*(lastUdot + Udot);
+ V += 0.5*dt*rate*(lastVdot + Vdot);
+ W += 0.5*dt*rate*(lastWdot + Wdot);
Vt = U*U+V*V+W*W > 0.0 ? sqrt(U*U + V*V + W*W) : 0.0;
{
dt = State->Getdt();
- P = State->GetP();
- Q = State->GetQ();
- R = State->GetR();
-
- Fx = State->GetFx();
- Fy = State->GetFy();
- Fz = State->GetFz();
-
- m = State->Getm();
- g = State->Getg();
- rho = State->Getrho();
+ P = Rotation->GetP();
+ Q = Rotation->GetQ();
+ R = Rotation->GetR();
- phi = State->Getphi();
- tht = State->Gettht();
- psi = State->Getpsi();
+ Fx = Aircraft->GetFx();
+ Fy = Aircraft->GetFy();
+ Fz = Aircraft->GetFz();
- U = State->GetU();
- V = State->GetV();
- W = State->GetW();
+ Mass = Aircraft->GetMass();
+ rho = Atmosphere->Getrho();
- Udot = State->GetUdot();
- Vdot = State->GetVdot();
- Wdot = State->GetWdot();
-
- alpha = State->Getalpha();
- beta = State->Getbeta();
+ phi = Rotation->Getphi();
+ tht = Rotation->Gettht();
+ psi = Rotation->Getpsi();
}
void FGTranslation::PutState(void)
{
- State->SetU(U);
- State->SetV(V);
- State->SetW(W);
-
State->SetVt(Vt);
State->Setqbar(qbar);
-
- State->SetUdot(Udot);
- State->SetVdot(Vdot);
- State->SetWdot(Wdot);
-
- State->Setalpha(alpha);
- State->Setbeta(beta);
}