X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FYASim%2FAtmosphere.cpp;h=92d2fbe56a6e3495762d2c2ffff5c96c42e134e8;hb=c8b8722a14d29e2b4153c39ad4cef0c44a562afd;hp=83c6b974897862d3e0fe7ea485a7e028b14d4624;hpb=0cabedaa4f8ce11bdab4d182937110d111d2590c;p=flightgear.git diff --git a/src/FDM/YASim/Atmosphere.cpp b/src/FDM/YASim/Atmosphere.cpp index 83c6b9748..92d2fbe56 100644 --- a/src/FDM/YASim/Atmosphere.cpp +++ b/src/FDM/YASim/Atmosphere.cpp @@ -102,6 +102,25 @@ float Atmosphere::calcMach(float spd, float temp) return spd / Math::sqrt(GAMMA * R * temp); } +float Atmosphere::spdFromMach(float mach, float temp) +{ + return mach * Math::sqrt(GAMMA * R * temp); +} + +float Atmosphere::spdFromVCAS(float vcas, float pressure, float temp) +{ + // FIXME: does not account for supersonic + float p0 = getStdPressure(0); + float rho0 = getStdDensity(0); + + float tmp = (vcas*vcas)/(7*p0/rho0) + 1; + float cp = ((Math::pow(tmp,(7/2.))-1)/(pressure/p0)) + 1; + + float m2 = (Math::pow(cp,(1/3.5))-1)/0.2; + float vtas= spdFromMach(Math::sqrt(m2), temp); + return vtas; +} + void Atmosphere::calcStaticAir(float p0, float t0, float d0, float v, float* pOut, float* tOut, float* dOut) {