SUBROUTINE Calc_IAS c Subroutine to calculate IAS from each 40 Hz sample and store c in common array, also does Pres Alt c All values are in system common, so no passed params IMPLICIT none INCLUDE "FastCom.ftni" C Local storage INTEGER i REAL PQerr,PSerr,PQc,PSc,rslt DO i = 1,40 ! do all samples this sec C Calc PQerr for this sample. Equation is: C PQerr = a*PQm + b*(PQm^2) + c*(PQm^2.5) + d*(PQm^3) C IF (PQarray(i).LT.0.01) PQarray(i) = 0.01 ! stay safe for exp PQerr = PQEcns(1) * PQarray(i) + & PQEcns(2) * PQarray(i)**2 + & PQEcns(3) * PQarray(i)**2.5 + & PQEcns(4) * PQarray(i)**3 C next is PSerr - watch the /0. Equation is: C PSerr = a + b/(1+(PSm/c)^d) + e/(1+(PSm/f)^g) C PSerr = PSEcns(1) ! always do the constant IF (PSEcns(3).NE.0) THEN ! guard /0 PSerr = PSerr + PSEcns(2) / & (1 + (PSarray(i)/PSEcns(3))**PSEcns(4)) ENDIF IF (PSEcns(6).NE.0) THEN ! guard /0 PSerr = PSerr + PSEcns(5) / & (1 + (PSarray(i)/PSEcns(6))**PSEcns(7)) ENDIF C Modify PQ by the error factors to create a corrected PQ PQc = PQarray(i) + PQerr + PSerr C Do the actual IAS calc from corrected PQ rslt = (PQc/1013.25 +1)**0.285714 - 1 IF (rslt.GE.0) THEN ! guard against neg sqrt IASarray(i) = 661.4788 * SQRT(5.*rslt) ! in knots ELSE ! just do something safe IASarray(i) = 0.0 ENDIF C Lastly do the Pres Alt calc PSc = PSarray(i) - PQerr + PSerr IF (PSc.GT.100. .AND. PSc.LT.1050.) THEN PAlt(i) = 44331.0*(1.0-(PSc/1013.25)**0.190263) ! in meters ELSE ! bad PS, flag it PAlt(i) = -999. ENDIF END DO ! end of loop on 40 samples RETURN END