X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2FFGAuxiliary.cpp;h=09b2aefc74dc08993f3dc40adb88e43302d18545;hb=fbee3d10f0aafd4178fc1313edb8593c156b2874;hp=a4a430b90fde24fdd969f7632ed6709724329d04;hpb=815333af23c86aef9ea8ae2b19b3e9b5da3c2af3;p=flightgear.git diff --git a/src/FDM/JSBSim/FGAuxiliary.cpp b/src/FDM/JSBSim/FGAuxiliary.cpp index a4a430b90..09b2aefc7 100644 --- a/src/FDM/JSBSim/FGAuxiliary.cpp +++ b/src/FDM/JSBSim/FGAuxiliary.cpp @@ -47,14 +47,8 @@ INCLUDES #include "FGAtmosphere.h" #include "FGState.h" #include "FGFDMExec.h" -#include "FGFCS.h" #include "FGAircraft.h" -#include "FGPosition.h" -#include "FGOutput.h" #include "FGInertial.h" -#include "FGMatrix33.h" -#include "FGColumnVector3.h" -#include "FGColumnVector4.h" #include "FGPropertyManager.h" namespace JSBSim { @@ -98,28 +92,33 @@ bool FGAuxiliary::Run() if (!FGModel::Run()) { GetState(); - //caculate total temperature assuming isentropic flow + //calculate total temperature assuming isentropic flow tat=sat*(1 + 0.2*mach*mach); + tatc=RankineToCelsius(tat); if (mach < 1) { //calculate total pressure assuming isentropic flow - pt=p*pow((1 + 0.2*mach*mach),3.5); + pt = p*pow((1 + 0.2*machU*machU),3.5); } else { // shock in front of pitot tube, we'll assume its normal and use // the Rayleigh Pitot Tube Formula, i.e. the ratio of total // pressure behind the shock to the static pressure in front - B = 5.76*mach*mach/(5.6*mach*mach - 0.8); + B = 5.76*machU*machU/(5.6*machU*machU - 0.8); // The denominator above is zero for Mach ~ 0.38, for which // we'll never be here, so we're safe - D = (2.8*mach*mach-0.4)*0.4167; + D = (2.8*machU*machU-0.4)*0.4167; pt = p*pow(B,3.5)*D; } A = pow(((pt-p)/psl+1),0.28571); - vcas = sqrt(7*psl/rhosl*(A-1)); - veas = sqrt(2*qbar/rhosl); + if (machU > 0.0) { + vcas = sqrt(7*psl/rhosl*(A-1)); + veas = sqrt(2*qbar/rhosl); + } else { + vcas = veas = 0.0; + } // Pilot sensed accelerations are calculated here. This is used // for the coordinated turn ball instrument. Motion base platforms sometimes @@ -162,11 +161,10 @@ bool FGAuxiliary::Run() vPilotAccel.InitMatrix(); if ( Translation->GetVt() > 1 ) { vPilotAccel = Aerodynamics->GetForces() - + Propulsion->GetForces() - + GroundReactions->GetForces(); + + Propulsion->GetForces() + + GroundReactions->GetForces(); vPilotAccel /= MassBalance->GetMass(); - vToEyePt = Aircraft->GetXYZep() - MassBalance->GetXYZcg(); - vToEyePt *= inchtoft; + vToEyePt = MassBalance->StructuralToBody(Aircraft->GetXYZep()); vPilotAccel += Rotation->GetPQRdot() * vToEyePt; vPilotAccel += Rotation->GetPQR() * (Rotation->GetPQR() * vToEyePt); } else { @@ -174,8 +172,7 @@ bool FGAuxiliary::Run() } vPilotAccelN = vPilotAccel/Inertial->gravity(); - - + earthPosAngle += State->Getdt()*Inertial->omega(); return false; } else { @@ -222,8 +219,12 @@ void FGAuxiliary::bind(void) &FGAuxiliary::GetVequivalentFPS); PropertyManager->Tie("velocities/ve-kts", this, &FGAuxiliary::GetVequivalentKTS); + PropertyManager->Tie("velocities/machU", this, + &FGAuxiliary::GetMachU); PropertyManager->Tie("velocities/tat-r", this, &FGAuxiliary::GetTotalTemperature); + PropertyManager->Tie("velocities/tat-c", this, + &FGAuxiliary::GetTAT_C); PropertyManager->Tie("velocities/pt-lbs_sqft", this, &FGAuxiliary::GetTotalPressure); @@ -257,6 +258,9 @@ void FGAuxiliary::unbind(void) PropertyManager->Untie("velocities/vc-kts"); PropertyManager->Untie("velocities/ve-fps"); PropertyManager->Untie("velocities/ve-kts"); + PropertyManager->Untie("velocities/machU"); + PropertyManager->Untie("velocities/tat-r"); + PropertyManager->Untie("velocities/tat-c"); PropertyManager->Untie("accelerations/a-pilot-x-ft_sec2"); PropertyManager->Untie("accelerations/a-pilot-y-ft_sec2"); PropertyManager->Untie("accelerations/a-pilot-z-ft_sec2"); @@ -275,6 +279,7 @@ void FGAuxiliary::GetState(void) { qbar = Translation->Getqbar(); mach = Translation->GetMach(); + machU= Translation->GetMachU(); p = Atmosphere->GetPressure(); rhosl = Atmosphere->GetDensitySL(); psl = Atmosphere->GetPressureSL();