Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50110/perfgs.eng
There are 2 other files named perfgs.eng in the archive. Click here to see a list.
100' NAME--PERFGAS
110'
120' DESCRIPTION--FINDS PROPERTIES OF 14 COMMON GASES, TREATED AS
130' THOUGH THEY WERE PERFECT GASES.
140'
150' SOURCE--DEAN MYRON TRIBUS, THAYER SCHOOL OF ENGINEERING
160'
170' INSTRUCTIONS--TYPE "RUN", INSTRUCTIONS ARE UNDER PROGRAM "PRFGASE"
180' FOR FAST INPUT, PUT K9=1 IN LINE 230 AND SEE LINES 700 TO 830
190'
200'
210' * * * * * * * * MAIN PROGRAM * * * * * * * * * * *
220'
230 LET K9=0
240 DIM G$(20)
250 DIM A(3,14)
260 LET E9=0.001 'ALLOWABLE ERROR
270'
280 FOR J=1 TO 14
290 READ G$(J)
300 FOR I=0 TO 3
310 READ A(I,J)
320 LET A(I,J)=A(I,J)*(10^(-3*I))
330 NEXT I
340 NEXT J
350 DATA "AIR",6.713,0.49697,1.147,-0.4696
360 DATA "CO",6.726,0.4001,1.283,-0.5307
370 DATA "CO2",5.316,14.285,-8.362,1.784
380 DATA "H2",6.952,-0.4576,0.9563,-0.2079
390 DATA "H2O",7.7,0.4594,2.521,-0.8587
400 DATA "O2",6.085,3.631,-1.709,0.3133
410 DATA "N2",6.903,-0.3753,1.930,-0.6861
420 DATA "NH3",6.5846,6.1251,2.3663,-1.5981
430 DATA "CH4",4.750,12.0,3.030,-2.630
440 DATA "C3H8",-0.966,72.79,-37.55,7.56
450 DATA "C4H10",0.945,88.73,-43.80,8.360
460 DATA "C6H6",-8.65,115.78,-75.4,18.54
470 DATA "C2H2",5.21,22.008,-15.59,4.349
480 DATA "CH30H",4.55,21.86,-2.91,-1.92
490 LET P0=1 'ATM
500 LET T0=273.18 'K
510 LET V0=22.42 'L/G-MOL
520 LET R=0.08208 'L-ATM/G-MOL,K
530 LET R1=1.987 'CAL/G-MOL,K
540 FOR K=1 TO 6
550 READ P$(K),X$(K)
560 NEXT K
570 DATA "T","DEG. K","H","CAL/G-MOL"
580 DATA "E","CAL/G-MOL","P","ATM"
590 DATA "V","LITER/G-MOL","S","CAL/G-MOL,K"
600'
610' DEFINITIONS
620'
630 DEF FNA(T,J)=A(0,J)*(T-T0)+A(1,J)*(T^2-T0^2)/2
640 DEF FNH(T,J)=FNA(T,J)+(A(2,J)*(T^3-T0^3)/3)+(A(3,J)*(T^4-T0^4)/4)
650'
660 DEF FNB(T,J)=A(O,J)*LOG(T/T0)+A(1,J)*(T-T0)
670 DEF FNS(T,J)=FNB(T,J)+(A(2,J)*(T^2-T0^2)/2)+A(3,J)*(T^3-T0^3)/3
680'
690 IF K9=0 THEN 860
700 READ G$' NAME OF GAS
710 DATA "AIR"
720 PRINT G$
730 FOR J=1 TO 14
740 IF G$=G$(J) THEN 760
750 NEXT J
760 LET V(1)=V(2)=V(3)=V(4)=V(5)=V(6)=0
770 READ A$,X1,B$,X2' (PROPERTY,VALUE,PRPPERTY,VALUE)
780' CAUTION: A$MUST NOT BE T,H,E
790 DATA "P",2,"T",1000,"S",8.07224,"V",41.04,"S",8.07224,"P",2
800 DATA
810 DATA
820 DATA
830 GO TO 960
840'
850'
860' START INPUT
870 PRINT "WHAT GAS";
880 INPUT G$
890 FOR J=1 TO 14
900 IF G$=G$(J) THEN 920
910 NEXT J
920 PRINT "YOU KNOW P,V OR S WHICH";
930 INPUT A$
940 PRINT "WHICH OF P,V,S,H,E,T DO YOU ALSO KNOW";
950 INPUT B$
960 FOR I=1 TO 6
970 IF A$<>P$(I) THEN 1010
980 LET K1=I
990 LET V(I)=X1
1000 IF K9=1 THEN 1110
1010 IF B$<>P$(I) THEN 1050
1020 LET K2=I
1030 IF K9=1 THEN 1050
1040 LET V(I)=X2
1050 NEXT I
1060 IF K9=1 THEN 1110
1070 PRINT "WHAT IS ";P$(K1);" IN ";X$(K1);
1080 INPUT V(K1)
1090 PRINT "WHAT IS ";P$(K2);" IN ";X$(K2);
1100 INPUT V(K2)
1110' LOGIC
1120 IF K1>3 THEN 1150
1130 PRINT "INPUT ERROR.FIRST NAMED PROPERTY CANNOT BE T,H OR E"
1140 STOP
1150 IF K2>3 THEN 1520 ' T,E,H NOT GIVEN
1160 IF K2=2 THEN 1320 '(H GIVEN)
1170 IF K2=3 THEN 1270 '(E GIVEN)
1180
1190 'T GIVEN
1200
1210'CASE 3
1220 GOSUB 1970 'TO GET H FROM T
1230 GOSUB 2020 'TO GET E FROM T
1240 GOTO 1340
1250'
1260'CASE 2
1270 GOSUB 2160 'TO GET T FROM E
1280 GOSUB 1970 'TO GET H FROM T
1290 GOTO 1340
1300'
1310'CASE 1
1320 GOSUB 2070 'TO GET T FROM H
1330 GOSUB 2020 'TO GET E FROM T
1340 'NOW T, H AND E ARE KNOWN
1350
1360 IF K1=4 THEN 1480 'T AND P KNOWN
1370 IF K1=5 THEN 1440 'T AND V KNOWN
1380' S GIVEN
1390
1400 GOSUB 2430 'TO GET P FROM S,T
1410 GOSUB 2250 'TO GET V
1420 GO TO 1790 'PRINTOUT
1430'
1440 GOSUB 2310 'P FROM T,V
1450 GOSUB 2370 'S FROM P,T
1460 GO TO 1790 'PRINTOUT
1470'
1480 GOSUB 2250 'V FROM T,P
1490 GOSUB 2370 'S FROM P,T
1500 GOTO 1790 'PRINTOUT
1510'
1520' USE K1 AND K2 TO DECIDE AMONG CASES 7,8,9
1530 ON K1+K2-8 GO TO 1560,1630,1700 '(CASES 7,8,9)
1540'
1550'CASE 7; P,V GIVEN
1560 GO SUB 2720 'SUB K GET T FROM P,V
1570 GO SUB 2360 ' SUB G S FROM P,T
1580 GO SUB 1960' SUB A H FROM T
1590 GO SUB 2010' SUB B E FROM T
1600 GO TO 1790' PRINTOUT
1610'
1620' CASE 8; S,P GIVEN
1630 GO SUB 2480' SUB I T FROM S,P
1640 GO SUB 2240' SUB E V FROM P,T
1650 GO SUB 1960' SUB A H FROM T
1660 GO SUB 2010' SUB B E FROM T
1670 GO TO 1790' PRINTOUT
1680'
1690' CASE 9; S,V GIVEN
1700 GO SUB 2600' SUB J T FROM S,V
1710 GO SUB 2300' SUB F P FROM T,V
1720 GO SUB 1960' SUB A H FROM T
1730 GO SUB 2010' SUB B E FROM T
1740'
1750'ALL CASES CMPLETED
1760'
1770'
1780' PRINTOUT STARTS HERE
1790 IF K9=1 THEN 1810
1800 PRINT G$(J)
1810 PRINT
1820 FOR I=1 TO 4 STEP 3
1830 PRINT P$(I)"="V(I);X$(I);TAB(25);P$(I+1)"="V(I+1);X$(I+1);
1840 PRINT TAB(50);P$(I+2)"="V(I+2);X$(I+2)
1850 NEXT I
1860 PRINT
1870 IF K9=1 THEN 760
1880 PRINT
1890 PRINT "MORE";
1900 INPUT Z$
1910 IF Z$="YES" THEN 920
1920 STOP
1930'
1940'
1950' SUBROUTINES
1960'SUB A FINDS H FROM T
1970 LET T=V(1)
1980 LET V(2)=H=FNH(T,J)
1990 RETURN
2000'
2010'SUB B FINDS E FROM T
2020 LET T=V(1)
2030 LET E=V(3)=FNH(T,J)-R1*T
2040 RETURN
2050'
2060'SUB C FINDS T FROM H
2070 LET H=V(2)
2080 LET T=T0+H/A(O,J)
2090 IF H=0 THEN 2120
2100 LET T=T0+H*(T-T0)/FNH(T,J)
2110 IF ABS(H-FNH(T,J))>E9*H THEN 2100
2120 LET V(1)=T
2130 RETURN
2140'
2150'SUB D, FINDS T FROM E
2160 LET E=V(3)
2170 LET T=T0+(E+R1*T0)/A(0,J)
2180 IF E+R1*T0=0 THEN 2210
2190 LET T=T0+(E+R1*T0)*(T-T0)/(FNH(T,J)-R1*(T-T0))
2200 IF ABS(E+R1*T-FNH(T,J))>E*E9 THEN 2190
2210 LET V(1)=T
2220 RETURN
2230'
2240'SUB E FINDS V FROM P AND T
2250 LET T=V(1)
2260 LET P=V(4)
2270 LET V=V(5)=R*T/P
2280 RETURN
2290'
2300'SUB F FINDS P FROM T AND V
2310 LET T=V(1)
2320 LET V=V(5)
2330 LET P=V(4)=R*T/V
2340 RETURN
2350'
2360'SUBG FINDS S FROM P AND T
2370 LET P=V(4)
2380 LET T=V(1)
2390 LET S=V(6)=FNS(T,J)-R1*LOG(P)
2400 RETURN
2410'
2420'SUB H FINDS P FROM S AND T
2430 LET T=V(1)
2440 LET S=V(6)
2450 LET P=V(4)=EXP((FNS(T,J)-S)/R1)
2460 RETURN
2470'
2480'SUB I FINDS T FROM S AND P
2490 LET S=V(6)+R1*LOG(V(4))
2500 LET T=T0
2510 IF S=0 THEN 2570
2520 LET C=A(0,J)
2530 LET T=T0*EXP(S/C)
2540 LET C=FNS(T,J)/LOG(T/T0)
2550 LET T=T0*EXP(S/C)
2560 IF ABS(S-FNS(T,J))>E9*S THEN 2540
2570 LET V(1)=T
2580 RETURN
2590'
2600'SUB J FINDS T FROM S AND V
2610 LET S=V(6)-R1*LOG(V(5)/V0)
2620 LET T=T0
2630 IF S=0 THEN 2700
2640 LET C=A(0,J)-R1
2650 LET T=T0*EXP(S/C)
2660 LET C=(FNS(T,J)/LOG(T/T0))-R1
2670 LET T=T0*EXP(S/C)
2680 IF ABS(S-FNS(T,J)+R1*LOG(T/T0))>E9*S THEN 2660
2690 LET V(1)=T
2700 RETURN
2710'
2720'SUB K FINDS T FROM P AND V
2730 LET P=V(4)
2740 LET V=V(5)
2750 LET T=V(1)=P*V/R
2760 RETURN
2770'
2780 END