]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGAuxiliary.cpp
Updates from JSBSim, including new turbine engine model from David Culp
[flightgear.git] / src / FDM / JSBSim / FGAuxiliary.cpp
index 698c7faab654b4bf97aac98e4f0328a8ef9e45e9..aa188c32c446c1d2b68a1276dceaaa60b37ce17a 100644 (file)
@@ -41,6 +41,7 @@ INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #include "FGAuxiliary.h"
+#include "FGAerodynamics.h"
 #include "FGTranslation.h"
 #include "FGRotation.h"
 #include "FGAtmosphere.h"
@@ -56,6 +57,8 @@ INCLUDES
 #include "FGColumnVector4.h"
 #include "FGPropertyManager.h"
 
+namespace JSBSim {
+
 static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_AUXILIARY;
 
@@ -73,6 +76,8 @@ FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
   
   vPilotAccelN.InitMatrix();
   
+  bind();
+  
   Debug(0);
 }
 
@@ -80,6 +85,7 @@ FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
 
 FGAuxiliary::~FGAuxiliary()
 {
+  unbind();
   Debug(1);
 }
 
@@ -91,6 +97,10 @@ bool FGAuxiliary::Run()
 
   if (!FGModel::Run()) {
     GetState();
+    
+    //caculate total temperature assuming isentropic flow
+    tat=sat*(1 + 0.2*mach*mach);
+    
     if (mach < 1) {   //calculate total pressure assuming isentropic flow
       pt=p*pow((1 + 0.2*mach*mach),3.5);
     } else {
@@ -151,17 +161,21 @@ bool FGAuxiliary::Run()
     
     vPilotAccel.InitMatrix();   
     if ( Translation->GetVt() > 1 ) {
-      vToEyePt = Aircraft->GetXYZep() - MassBalance->GetXYZcg();
-      vToEyePt *= inchtoft;
-      vPilotAccel =  Aerodynamics->GetForces() 
+       vPilotAccel =  Aerodynamics->GetForces() 
                   +  Propulsion->GetForces()
                   +  GroundReactions->GetForces();
-      vPilotAccel /= MassBalance->GetMass();
-      vPilotAccel += Rotation->GetPQRdot() * vToEyePt;
-      vPilotAccel += Rotation->GetPQR() * (Rotation->GetPQR() * vToEyePt);
-      //vPilotAccel(2)*=-1;
-      vPilotAccelN = vPilotAccel/Inertial->gravity();
-    }
+       vPilotAccel /= MassBalance->GetMass();
+       vToEyePt = Aircraft->GetXYZep() - MassBalance->GetXYZcg();
+       vToEyePt *= inchtoft;
+       vPilotAccel += Rotation->GetPQRdot() * vToEyePt;
+       vPilotAccel += Rotation->GetPQR() * (Rotation->GetPQR() * vToEyePt);
+    } else {
+       vPilotAccel = -1*( State->GetTl2b() * Inertial->GetGravity() );
+    }   
+
+    vPilotAccelN = vPilotAccel/Inertial->gravity();
+      
+    
     earthPosAngle += State->Getdt()*Inertial->omega();
     return false;
   } else {
@@ -208,6 +222,11 @@ void FGAuxiliary::bind(void)
                        &FGAuxiliary::GetVequivalentFPS);
   PropertyManager->Tie("velocities/ve-kts", this,
                        &FGAuxiliary::GetVequivalentKTS);
+  PropertyManager->Tie("velocities/tat-r", this,
+                       &FGAuxiliary::GetTotalTemperature);
+  PropertyManager->Tie("velocities/pt-lbs_sqft", this,
+                       &FGAuxiliary::GetTotalPressure);
+                     
   PropertyManager->Tie("accelerations/a-pilot-x-ft_sec2", this,1,
                        (PMF)&FGAuxiliary::GetPilotAccel);
   PropertyManager->Tie("accelerations/a-pilot-y-ft_sec2", this,2,
@@ -259,6 +278,7 @@ void FGAuxiliary::GetState(void)
   p = Atmosphere->GetPressure();
   rhosl = Atmosphere->GetDensitySL();
   psl = Atmosphere->GetPressureSL();
+  sat = Atmosphere->GetTemperature();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -307,3 +327,4 @@ void FGAuxiliary::Debug(int from)
   }
 }
 
+} // namespace JSBSim