10 KEY OFF 20 SCREEN 0:CLS 30 COLOR 10:PRINT :LOCATE 2,20:PRINT "P S V C A L C U L A T I O N S P R O G R A M" 40 LOCATE 4,25:PRINT "Date developed : Dec. 15th, '96" 50 LOCATE 5,25:PRINT "Revision : 00" 60 LOCATE 6,25:PRINT "Reference : DCPP,vol 1,Ernest E.Ludwig" 70 LOCATE 7,25:PRINT "Developed by : AJ" 80 LOCATE 8,25:PRINT "Contributed by : AJ" 90 LOCATE 9,25:PRINT "Validated by : SS,NA" 100 LOCATE 15,10:COLOR 27:PRINT "Please make sure that this is the latest revision of the program" 110 LOCATE 20,30:COLOR 10:PRINT "Press any key to move ahead" 120 IF INKEY$="" THEN 120 130 CLS 140 LOCATE 10,20:INPUT "Enter the Tag of the PSV :";TAG$ 150 LOCATE 11,20:INPUT "Enter the service :";SER$ 160 CLS 170 LOCATE 5,15:PRINT "What is the basis of calculation :" 180 LOCATE 7,25:PRINT "1. Blocked Valve" 190 LOCATE 8,25:PRINT "2. Fire" 192 LOCATE 9,25:PRINT "3. Quit" 200 LOCATE 12,15 :INPUT "Enter your case # (1/2, 3 to quit):";CASE 210 IF CASE=1 THEN 230 220 IF CASE=2 THEN 960 221 IF CASE=3 THEN END ELSE 200 230 CLS 240 LOCATE 4,25:PRINT "Your Service could be :" 250 LOCATE 6, 30:PRINT "1. Gas" 260 LOCATE 7,30:PRINT "2. Liquid" 270 LOCATE 8,30:PRINT "3. steam" 280 LOCATE 9,30:PRINT "4. Air" 290 LOCATE 10,30:PRINT "5. Quit" 300 LOCATE 15,25:INPUT "Enter your choice :";CH 310 IF CH<1 OR CH >5 THEN 300 320 ON CH GOTO 330,1170,1430,1700,1420 330 CLS 340 LOCATE 5,10:INPUT "Enter the set Pressure (Kgf/cm2 a) :";P:P1=14.7*P 342 LOCATE 6,10:INPUT "Enter the Overpressure (%) :";OPR 344 PTOT=P1*(1+(OPR/100)) 350 LOCATE 7,10:INPUT "Enter the specific heat ratio :";K 360 IF K=1 THEN 370 ELSE 410 370 PC=PTOT*.66:GOTO 420 'pc/ptot=.66 for k=1 410 PC=PTOT*((2/(K+1))^(K/(K-1))) 420 LOCATE 8,10 :INPUT "Enter the Back pressure (Kgf/cm2 a):";PB:PB=14.7*PB 430 IF PB60 % 580 LOCATE 11,10:PRINT "The X-value on Fig 7-19 is :";AB 590 LOCATE 12,10:INPUT "Enter the factor Kb (Fig 7-19) :";KB 600 KR=.97:A=W1*((Z*R/M))^(1/2)/(C*KR*PTOT*KB) 610 CLS 618 LOCATE 2,20:PRINT "PSV SIZING FOR GAS SERVICE" 620 LOCATE 4,30:PRINT TAG$ 630 LOCATE 6,10:PRINT "Service :";" ";SER$ 640 LOCATE 7,10:PRINT "Flow rate :";W ;"Kg/Hr 650 LOCATE 8,10:PRINT "Compressibility Factor :";Z 660 LOCATE 9,10:PRINT "Temperature :";T;CHR$(248);"C" 670 LOCATE 10,10:PRINT "Set Pressure :";P;" Kg/cm2 a" 672 LOCATE 11,10:PRINT "Overpressure :";OPR;"%" 674 LOCATE 12,10:PRINT "Back Pressure :";PB/14.7;" Kg/cm2 a" 680 LOCATE 13,10:PRINT "Molecular Weight :";M 690 LOCATE 15,10:PRINT "Flow status : CRITICAL" 700 LOCATE 16,10:PRINT "Area Required (in2) :";A 710 IF INKEY$="" THEN 710 720 GOTO 20 730 'gas flow for non-critical case 740 CLS 750 LOCATE 5,10:INPUT "Enter the flow rate (Nm3/hr) :";DUMMY 760 LOCATE 6,10:INPUT "Enter the temperature (Deg C) :";T:F=(9/5)*T+32:R=F+459.7 770 LOCATE 7,10 :INPUT "Enter the Molecular weight :";M 780 W=M*DUMMY/22.4 :W1=W/.454 'lbs/hr 790 KR=.97:K=.97 'here k is not cp/cv but nozzle coefficient 800 TEMP=((M/R)*(K/(K-1))*((PB/P1)^(2/K))*(1-((PB/P1)^((K-1)/K))))^(1/2) 810 A=W1/(735*KR*PTOT*TEMP) 820 CLS 828 LOCATE 2,20:PRINT "PSV SIZING FOR GAS SERVICE" 830 LOCATE 4,30:PRINT TAG$ 840 LOCATE 6,10:PRINT "Service :";" ";SER$ 850 LOCATE 7,10:PRINT "Flow rate :";W;"Kg/Hr 860 LOCATE 8,10:PRINT "Temperature :";T;CHR$(248);"C" 870 LOCATE 9,10:PRINT "Set Pressure :";P;" Kg/cm2 a" 872 LOCATE 10,10:PRINT "Overpressure :";OPR;"%" 880 LOCATE 11,10:PRINT "Back Pressure :";PB/14.7;" Kg/cm2 a" 890 LOCATE 12,10:PRINT "Molecular Weight :";M 900 LOCATE 14,10:PRINT "Flow status : NON-CRITICAL" 910 LOCATE 15,10:PRINT "AREA REQUIRED (in2) :";A;"(";A*25.4*25.4;"mm2)" 920 IF INKEY$="" THEN 920 930 GOTO 20 940 'FIRE case 960 CLS 970 LOCATE 5,35:PRINT "Environment Factor F" 980 LOCATE 7,15:PRINT "Type of installation Factor F" 990 LOCATE 8,15:PRINT "1.Bare Vessel 1.0" 1000 LOCATE 9,15:PRINT "2.Insulated Vessels" 1010 LOCATE 10,15:PRINT " Insulation conductance(Btu/hr/ft2/F)" 1020 LOCATE 11,15:PRINT " (a) 4.0 0.3" 1030 LOCATE 12,15:PRINT " (b) 2.0 0.15" 1040 LOCATE 13,15:PRINT " (c) 1.0 0.075" 1050 LOCATE 14,15:PRINT "3.Water-application facilities,on bare vessel 1.0" 1060 LOCATE 15,15:PRINT "4.Depressurizing and emptying facilities 1.00" 1070 LOCATE 16,15:PRINT "5.Underground Storage 0.0" 1080 LOCATE 17,15:PRINT "6.Earth-covered storage above grade 1.0" 1090 LOCATE 20,10:INPUT "Enter the factor F (Above table) :";F 1100 LOCATE 21,10:INPUT "Enter the total wetted surface area (m2) :";A:A=A*10.7639 'ft2 1110 Q=21000*F*((A)^.82) 1120 LOCATE 22,10:INPUT "Enter the latent heat at allow. pressure(Kcal/kg):";L:L=L*1.801587 'Btu/lb 1130 W=Q/L :W=W*.454 1140 CLS :LOCATE 10,20:PRINT "The required capacity is :";W;" Kg/hr" 1150 IF INKEY$="" THEN 1150 1160 GOTO 230 1170 'Liquid subroutine 1180 CLS 1190 LOCATE 5,10:INPUT "Enter the set Pressure (Kgf/cm2 a) :";P:P1=14.7*P 1200 LOCATE 7,10:INPUT "Enter the Back Pressure (Kgf/cm2 a):";PB:PB1=14.7*PB 1210 DELP=P1-PB1 1220 LOCATE 9,10:INPUT "Enter the flow rate (Kg/hr) :";W 1230 LOCATE 11,10:INPUT "Enter the density (Kg/m3) :";DEN 1240 VOL=W/DEN 'm3/hr 1250 GPM= 264.17*VOL/60 1260 G=DEN/1000 1261 LOCATE 1,53:PRINT "Overpressure(%) Kp" 1262 LOCATE 2,53:PRINT " 10 % 0.6" 1263 LOCATE 3,53:PRINT " 15 % 0.79" 1264 LOCATE 4,53:PRINT " 20 % 0.92" 1265 LOCATE 5,53:PRINT " 25 % 1.0" 1270 LOCATE 13,10:INPUT "Enter the factor Kp(Ovrpr factor) :";KP 1280 LOCATE 15,10:INPUT "Enter the factor Kv(Visc factor) :";KV 1290 A=GPM*(G^.5)/(27.2*KP*KV*(DELP^.5)) 1300 CLS 1302 LOCATE 2,20:PRINT "PSV SIZING FOR LIQUID SERVICE" 1310 LOCATE 4,30:PRINT TAG$ 1320 LOCATE 6,10:PRINT "Service :";" ";SER$ 1330 LOCATE 7,10:PRINT "Flow rate :";W ;"Kg/Hr 1340 LOCATE 8,10:PRINT "Specific Gravity :";G 1350 LOCATE 9,10:PRINT "Set Pressure :";P;" Kg/cm2 a" 1360 LOCATE 10,10:PRINT "Back Pressure :";PB;" Kg/cm2 a" 1370 LOCATE 12,10:PRINT "Area Required (in2) :";A;"(";A*25.4*25.4;"mm2)" 1380 IF INKEY$="" THEN 710 1390 GOTO 20 1400 ' 1410 ' 1420 END 1430 'routine for Steam service 1432 CLS 1440 LOCATE 2,18:PRINT "Subroutine for Steam Service PSV Calculations" 1450 LOCATE 5,20:INPUT "Enter the Steam flow rate (Kg/hr) :";WS:WS1=WS/.454 1460 LOCATE 6,20:INPUT "Enter the Set Pressure (Kg/cm2 a) :";P:P1=1.1*P*14.7+14.7 1470 LOCATE 7,20:INPUT "Enter Kb(Back Pr. factor,fig 7-19) :";KB 1480 LOCATE 8,20:INPUT "Enter Ks(Superht factor,table 7-4) :";KS 1490 A=WS1/(51.5*.97*P1*KB*KS) 1500 LOCATE 20,25:PRINT "Press any key to continue" 1510 IF INKEY$="" THEN 1510 1520 LOCATE 20,25:PRINT " " 1530 CLS 1540 LOCATE 2,18:PRINT "Subroutine for Steam Service PSV Calculations" 1550 LOCATE 5,20:PRINT "Steam flow rate :";WS;"Kg/hr" 1560 LOCATE 6,20:PRINT "Set Pressure :";P;"Kg/cm";CHR$(253);" abs" 1570 LOCATE 7,20:PRINT "Back Pressure factor Kb :";KB 1580 LOCATE 8,20:PRINT "Superheat factor Ks :";KS 1590 LOCATE 10,15:COLOR 11:PRINT "The required area is :";A;"in";CHR$(253);"(";A*25.4*25.4;"mm";CHR$(253);")" 1598 COLOR 10:LOCATE 20,25:PRINT "Press any key to continue" 1600 IF INKEY$="" THEN 1600 1610 LOCATE 20,25:PRINT " " 1620 GOTO 20 1700 'routine for Air service 1710 CLS 1720 LOCATE 2,18:PRINT "Subroutine for Air Service PSV Calculations" 1730 LOCATE 5,20:INPUT "Enter the Air flow rate (Nm3/hr) :";VA:VA1=VA*.5886 ' ft3/min 1732 VA1=VA1*(273+15.5)/273 'Normal ft3/min to scfm conversion 1740 LOCATE 6,20:INPUT "Enter the Set Pressure (Kg/cm2 a) :";P:P1=1.1*P*14.7+14.7 1750 LOCATE 7,20:INPUT "Enter the operating temperature(øC):";T:T1=((9/5)*T+32)+459.7 1760 LOCATE 8,20:INPUT "Enter Kb(Back Pr. factor,Fig 7-19 :";KB 1770 A=VA1*(T1^.5)/(418*.97*P1*KB) 1780 LOCATE 20,25:PRINT "Press any key to continue" 1790 IF INKEY$="" THEN 1790 1810 CLS 1820 LOCATE 2,18:PRINT "Subroutine for Air Service PSV Calculations" 1830 LOCATE 5,20:PRINT "Air flow rate :";VA;"Nm3/hr" 1840 LOCATE 6,20:PRINT "Set Pressure :";P;"Kg/cm";CHR$(253);"a" 1850 LOCATE 7,20:PRINT "Operating temperature :";T;"øC" 1860 LOCATE 8,20:PRINT "Back Pressure factor Kb :";KB 1865 LOCATE 10,15:COLOR 11:PRINT "The required area is :";A;"in";CHR$(253);"(";A*25.4*25.4;"mm";CHR$(253);")" 1870 COLOR 10:LOCATE 20,25:PRINT "Press any key to continue" 1890 IF INKEY$="" THEN 1890 1900 LOCATE 20,25:PRINT " " 2000 GOTO 20