10 IF F$="f" OR F$="F" THEN PRINT USING "####.#";OBSTEMP*9/5+32; 20 'Program written and compiled by R. Gross, Santa Cruz, CA. This program may 30 'be used and copied by anyone for their own noncommercial use. 40 'The writer accepts no responsibility for the consequences of using this 50 'program. 60 'Certain portions copyright (C) Microsoft Corporation. 70 '***************************************************** 80 'The first section of the program calls for the user to declare whether he 90 'wishes to use Celsius (Centigrade) or Fahrenheit for his temperature read- 100 'out. The routines following assume that all temperatures will be given in 110 'the units as previously declared, i.e., all Celsius or all Fahrenheit. 120 ' 130 'It should be noted that the temperatures called for in the beginning of the 140 'program are Static Air Temperatures (OAT), not indicated temperatures. 150 'Most light reciprocating aircraft are slow enough that no ram (friction) 160 'correction need to be made to the indicated temperature, however nearly 170 'all jet aircraft cruise at a mach number high enough to require correction 180 'from Indicated to Static temperatures in order to give correct results. 190 ' 200 'Note that at certain pressure altitudes, the computed density altitude will 210 'disagree by a few feet when the computed standard temperature is entered. 220 'This is because of (1) rounding of coefficients used in the equations, and 230 '(2) internal rounding errors in the computer itself. 231 'This program has been modified to run on an H/Z-89,H/Z-90 CP/M-80 system 240 PRINT CHR$(27);CHR$(69) 250 PRINT TAB(30)"DENSALT PROGRAM" 251 PRINT 260 'calculate standard air temperature 270 INPUT "Pressure altitude in feet above msl=";PRESSALT 280 'compute standard atmospheric pressure ratio, delta 290 DELTA=((288.2-.001981*PRESSALT)/288.2)^5.2561 300 IF PRESSALT>36089! THEN LET DELTA=.2234*EXP(-(PRESSALT-36089!)/20806) 310 'compute standard atmosphere temperature and absolute temperature 320 STDTEMP=-.001981*PRESSALT+15:STDABSTEMP=-.001981*PRESSALT+288.2 330 IF PRESSALT>36089! THEN LET STDTEMP=-56.5:STDABSTEMP=216.7 340 PRINT 350 'determine Celsius or Fahrenheit basis 360 PRINT " Do you want temperature in Celsius [C] or Fahrenheit (F)?" 370 F$=INKEY$:IF F$="" THEN 370 380 PRINT 390 PRINT "Standard temperature at";PRESSALT; 400 PRINT " feet msl="; 410 IF F$<>"f" AND F$<>"F" THEN PRINT USING "####.#";STDTEMP; 420 IF F$<>"f" AND F$<>"F" THEN PRINT CHR$(248);" C.":GOTO 460 430 'convert degrees Celsius (Centigrade) to Fahrenheit 440 PRINT USING "####.#";STDTEMP*9/5+32; 450 PRINT CHR$(248);" F." 460 ' 470 'routine to determine density altitude 480 PRINT 490 'enter observed (ambient) temperature 500 INPUT "Observed temperature";OBSTEMP 510 'convert degrees F. to degrees C. 520 IF F$="f" OR F$="F" THEN LET OBSTEMP=(OBSTEMP-32)*5/9 530 PRINT 540 'convert observed temperature to absolute temperature (degrees Kelvin) 550 OBSABSTEMP=OBSTEMP+273.2 560 'compute atmospheric temperature ratio, theta 570 THETA=OBSABSTEMP/288.2 580 'compute atmospheric density ratio, sigma 590 SIGMA=DELTA/THETA 600 'compute density altitude if pressure altitude above standard tropopause 610 IF PRESSALT>36089! THEN LET DENSALT=-20806*LOG(SIGMA/.2971)+36089!:GOTO 640 620 'compute density altitude if pressure altitude below standard tropopause 630 DENSALT=-(SIGMA^(1/4.2561)-1)/6.88E-06 640 PRINT 650 PRINT "At a Pressure Altitude of";PRESSALT;" feet and a Temperature of"; 660 IF F$="f" OR F$="F" THEN PRINT USING "####.#";OBSTEMP*9/5+32; 670 IF F$="f" OR F$="F" THEN GOTO 690 680 PRINT USING "####.#";OBSTEMP; 690 IF F$="f"OR F$="F" THEN PRINT CHR$(248);" F.," ELSE PRINT CHR$(248);" C.," 700 PRINT "the Density Altitude is "; 710 PRINT USING"######";DENSALT; 720 PRINT " feet." 730 PRINT 740 PRINT 750 REM 760 REM 761 PRINT 762 PRINT TAB(20)"Would you like to run another (Y or N)?";:X$=INPUT$(1) 763 IF X$="Y" THEN 770 764 IF X$="N" THEN 780 770 PRINT CHR$(27);CHR$(69):CLEAR:GOTO 240 780 PRINT CHR$(27);CHR$(69):END