home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / tech / jbl / newbox.bas < prev    next >
BASIC Source File  |  1986-02-06  |  20KB  |  484 lines

  1. 10 '        ############  VENTED BOX DESIGN PROGRAM ##############
  2. 20 ' written by Jeffrey E. Bollinger with additions by Rollins Brook
  3. 30 ' of BBN Laboratories and Drew Daniels of JBL Professional
  4. 40 ' based on algorithms developed by Don Keele at JBL, between 1976 and 1977
  5. 50 ' results are valid to +-10% or +-1dB for drivers with Qts between .25 & .65
  6. 60 ' written for IBM or MS BASICA 3.0 running under PC or MS DOS 3.0
  7. 70 ' contains SHELL commands in lines 34, 73, 239, and 240
  8. 80 ' SHELL is supported only by BASICA 3.0  or later
  9. 90 '
  10. 100 '
  11. 110 KEY OFF  'turns off function key display on line 25
  12. 120 EFF=0
  13. 130 ON ERROR GOTO 660
  14. 140 '
  15. 150 '
  16. 160 'dimension arrays
  17. 170 DIM FREQ(51)
  18. 180 FOR K=0 TO 50
  19. 190     FREQ(K)=INT(15.625*2^(K/10)*10+.5)/10  ' 1/10 oct calc 15 to 500 Hz
  20. 200     NEXT K
  21. 210 DIM FREQ.3(15)
  22. 220 FOR K=1 TO 15
  23. 230     READ FREQ.3(K)  'one-third octave 20 to 500 Hz
  24. 240          DATA 20,25,31,40,50,63,80,100,125,160,200,250,300,400,500
  25. 250     NEXT K
  26. 260 '
  27. 270 '
  28. 280 'variable definitions
  29. 290 LOG10=LOG(10) 'for use in log to base 10 calculations (logx=lnx/ln10)
  30. 300 PI=3.1415927#
  31. 310 '
  32. 320 '
  33. 330 'set display screen and color map
  34. 340 ' SHELL "GRAPHICS" 'enables graphics mode printscreen function
  35. 350 SCREEN 0 : WIDTH 80
  36. 360 CLS : COLOR 15,1,7 : CLS
  37. 370 '
  38. 380 '
  39. 390 '======= main menu =======
  40. 400 COLOR 15:LOCATE 1,1
  41. 410 OVERLAY$="N"
  42. 420 PRINT "                              BBN LABORATORIES  "
  43. 430 PRINT "                                D.B. KEELE JR."
  44. 440 PRINT "                          VENTED BOX DESIGN PROGRAM"
  45. 442 COLOR 31
  46. 450 PRINT : PRINT :PRINT"                      PLEASE SET CAPS LOCK TO UPPER CASE"   :PRINT :PRINT
  47. 452 COLOR 15
  48. 460 PRINT TAB(28);"****** MAIN MENU ******"
  49. 470 PRINT
  50. 480 PRINT TAB(25);"1 - Enter New Driver"
  51. 482 COLOR 7
  52. 490 PRINT TAB(25);"2 - Change Box Volume Vb"
  53. 500 PRINT TAB(25);"3 - Change -3dB Frequency f3"
  54. 502 COLOR 15
  55. 510 PRINT TAB(25);"4 - Draw Response Curve(s)"
  56. 520 PRINT TAB(25);"5 - Draw Response and Displacement Limits Curve(s)"
  57. 522 COLOR 7
  58. 530 PRINT TAB(25);"6 - Change Large-Signal Parameters"
  59. 532 COLOR 15
  60. 540 PRINT TAB(25);"7 - Optimum Vent Design"
  61. 542 COLOR 7
  62. 550 PRINT TAB(25);"8 - Change Vent Area"
  63. 560 PRINT TAB(25);"9 - Change Duct Length"
  64. 570 PRINT TAB(25);"0 - Exit Program"
  65. 572 COLOR 15
  66. 580 PRINT : INPUT "                        Your Choice "; CHOICE
  67. 590 IF CHOICE=6 THEN EFF=0: CLS
  68. 600 ON CHOICE GOSUB 770,1000,1120,1500,1500,1820,3680,4050,4330
  69. 610 IF CHOICE<>0 THEN GOTO 350  'redisplays menu after return from subroutine
  70. 620 COLOR 15,0,0:CLS:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT "             Confirm that you wish to stop the program by typing:"
  71. 630 PRINT :PRINT :PRINT :PRINT: PRINT TAB(28); "END to exit to BASICA"
  72. 640 PRINT: PRINT TAB(28); "DOS to exit to DOS"
  73. 650 INPUT "                                  ? ", EXIT$
  74. 660 IF EXIT$="END" OR EXIT$="end" THEN COLOR 15,0,0: CLS: END
  75. 670 IF EXIT$="DOS" OR EXIT$="dos" THEN SYSTEM
  76. 680 GOTO 350
  77. 690 '
  78. 700 '
  79. 710 '======= error subroutine =======
  80. 720 PRINT "error";ERR;"at line";ERL
  81. 730 SHELL "PAUSE"
  82. 740 GOTO 350 'resets to main menu
  83. 750 '
  84. 760 '
  85. 770 '======= enter new driver ========
  86. 780 CLS:PRINT:PRINT:PRINT :PRINT :PRINT
  87. 790 EFF=0: SV.MIN=0
  88. 800 INPUT "             Driver Description      "; DRIVER$ : PRINT
  89. 810 INPUT "             Driver Fs in Hz         ";FS : PRINT
  90. 820 IF FS < 1 THEN 810
  91. 830 INPUT "             Driver Qts              ";QTS : PRINT
  92. 840 IF QTS <.01 THEN 830
  93. 850 PRINT "             NOTE: for multiple drivers in
  94. 860 PRINT "             a single box, use Vas multiplied
  95. 870 PRINT "             by n drivers.
  96. 880 PRINT
  97. 890 INPUT "             Driver Vas in cubic feet";VAS : PRINT
  98. 900 IF VAS < .1 THEN 890
  99. 910 CLS: IF CHOICE<>1 THEN RETURN
  100. 920 VB=20*(QTS^3.3)*VAS  'start max flat calculations
  101. 930 F3=.28*(QTS^-1.4)*FS
  102. 940 FB=1.5*(QTS^.44)*F3
  103. 950 PRINT : PRINT TAB(23);"B4 MAXIMALLY FLAT ALIGNMENT":PRINT
  104. 960 GOSUB 1240    'printout
  105. 970 CLS: RETURN
  106. 980 '
  107. 990 '
  108. 1000 '======= change box volume response calculation =======
  109. 1010 IF FS=0 THEN GOSUB 770
  110. 1020 CLS:PRINT:PRINT :PRINT :PRINT :PRINT
  111. 1030 INPUT "New Box Volume Vb in cubic feet"; VB
  112. 1040 IF VB <.1 THEN 1030
  113. 1050 CLS:PRINT :PRINT :PRINT
  114. 1060 F3=FS*(VAS/VB)^.44
  115. 1070 FB=F3/(VAS/VB)^.13
  116. 1080 GOSUB 1240    'printout
  117. 1090 RETURN
  118. 1100 '
  119. 1110 '
  120. 1120 '======= change f3 response calculations =======
  121. 1130 IF FS=0 THEN GOSUB 770
  122. 1140 CLS:PRINT:PRINT :PRINT :PRINT :PRINT
  123. 1150 INPUT "        New -3dB point f3";F3
  124. 1160 IF F3 < 1 GOTO 1150
  125. 1170 CLS:PRINT :PRINT :PRINT
  126. 1180 VB=VAS/(F3/FS)^2.27
  127. 1190 FB=F3/(VAS/VB)^.13
  128. 1200 GOSUB 1240  'for printout
  129. 1210 RETURN
  130. 1220 '
  131. 1230 '
  132. 1240 '======= common small-signal response summary calc & printout =======
  133. 1250 RIPPLE=20*LOG(QTS*(VAS/VB)^.3/.4)/LOG10
  134. 1260 PRINT TAB(28);DRIVER$
  135. 1270 PRINT TAB(28) USING"Vb=###.## cubic feet";VB : GOTO 1280
  136. 1280 IF VB < 25 THEN Q=3 : IF VB < 19 THEN Q=5 : IF VB < 11 THEN Q=7
  137. 1290 PRINT TAB(28) USING"f3=###.# Hz";F3
  138. 1300 PRINT TAB(28) USING"Fb=###.# Hz";FB
  139. 1310 PRINT TAB(28) USING"Ripple= ##.# dB";RIPPLE
  140. 1320 LOCATE 22,12:COLOR 7: PRINT "       enter N for NO    press RETURN for YES"
  141. 1330 COLOR 15: LOCATE 8
  142. 1340 PRINT: PRINT: PRINT
  143. 1350 INPUT "            Do you wish to draw this alignment"; ANS$ : PRINT
  144. 1360 IF ANS$="N" OR ANS$="n" THEN RETURN
  145. 1370 INPUT "            Show thermal and displacement limits"; LIMITS$ : PRINT
  146. 1380 PRINT "            The default value of Qb is"; Q : PRINT
  147. 1390 INPUT "            Do you wish to use this value for Qb"; DEFAULT$ : PRINT
  148. 1400 IF DEFAULT$="N" OR DEFAULT$="n" THEN INPUT "        Preferred Qb"; Q
  149. 1410 VBMAX=VB: VBMIN=VB: VBSTEP=1
  150. 1420 FBMAX=FB: FBMIN=FB: FBSTEP=1
  151. 1430 IF LIMITS$<>"N" THEN CHOICE=5: IF EFF=0 THEN GOSUB 1890  'for large signal                                                                data input
  152. 1440 IF LIMITS$="N" THEN CHOICE=4
  153. 1450 OVERLAY$="N"
  154. 1460 GOSUB 2170  'for drawing routines
  155. 1470 RETURN
  156. 1480 '
  157. 1490 '
  158. 1500 '======= box size & tuning input =======
  159. 1510 IF FS=0 THEN GOSUB 770
  160. 1520 IF CHOICE=4 THEN LIMITS$="N"
  161. 1530 IF CHOICE=5 THEN LIMITS$="Y"
  162. 1540 IF CHOICE=5 AND EFF=0 THEN CLS: GOSUB 1820  'for large-signal data input
  163. 1550 CLS: LOCATE 1,15:COLOR 15:PRINT "     To answer YES/NO questions,    enter N for NO    press RETURN for YES"
  164. 1560 COLOR 15: LOCATE 1,,
  165. 1570 PRINT :PRINT :PRINT
  166. 1580 INPUT "               Compute more than 1 Box Size ";VOL$ : PRINT
  167. 1590 INPUT "               Compute more than 1 Box Tuning ";TUN$ : PRINT
  168. 1600 IF VOL$="N" OR VOL$="n" THEN INPUT "               Box Net Volume in cubic feet";VBMIN : PRINT : VBMAX=VBMIN : VBSTEP=1 : GOTO 1670
  169. 1610 INPUT "               Smallest Box Volume in cubic feet ";VBMIN : PRINT
  170. 1620 IF VBMIN < .1 THEN 1610
  171. 1630 INPUT "               Largest Box Volume in cubic feet ";VBMAX : PRINT
  172. 1640 IF VBMAX < .1 THEN 1630
  173. 1650 INPUT "               Volume increment between Box Sizes ";VBSTEP : PRINT
  174. 1660 IF VBSTEP < .1 THEN 1650
  175. 1670 IF TUN$="N" OR TUN$="n" THEN INPUT "               Box Tuning Fb in Hz ";FBMIN : FBMAX=FBMIN : FBSTEP=1 : PRINT : GOTO 1740
  176. 1680 INPUT "               Lowest Frequency Box Tuning f3 ";FBMIN : PRINT
  177. 1690 IF FBMIN < .1 THEN 1680
  178. 1700 INPUT "               Highest Frequency Box Tuning f3 ";FBMAX : PRINT
  179. 1710 IF FBMAX < .1 THEN 1700
  180. 1720 INPUT "               Frequency increment between Box Tunings ";FBSTEP : PRINT
  181. 1730 IF FBSTEP <.1 THEN 1720
  182. 1740 INPUT "               Do you wish to use the default value for Qb";DEFAULT$
  183. 1750 IF DEFAULT$="N" OR DEFAULT$="n" THEN PRINT : INPUT "               Preferred Qb is ";Q
  184. 1760 OVERLAY$="N"
  185. 1770 IF VOL$<>"N" OR TUN$<>"N" THEN INPUT "               Overlay drawings";OVERLAY$
  186. 1780 GOSUB 2170  'for drawing routines
  187. 1790 RETURN
  188. 1800 '
  189. 1810 '
  190. 1820 '======= large-signal driver parameter input =======
  191. 1830 IF CHOICE=6 OR CHOICE=5 THEN PRINT:PRINT:PRINT
  192. 1840 IF EFF<>0 THEN 2040
  193. 1850 SV.MIN=0
  194. 1860 PRINT "            NOTE: for multiple drivers in a single
  195. 1870 PRINT "            box, use Efficiency multiplied by n drivers.
  196. 1880 PRINT
  197. 1890 INPUT "            Driver 1/2 Space Efficiency in percent"; EFF : PRINT
  198. 1900 IF EFF < .01 THEN 1890
  199. 1910 PRINT "            for multiple drivers, multiply Pe by n drivers.
  200. 1920 PRINT
  201. 1930 INPUT "            Driver Input Power Limit (Pe) in Watts";PE : PRINT
  202. 1940 IF PE < 1 THEN 1930
  203. 1950 INPUT "            Driver Maximum Peak Linear Excursion (Xmax) in inches";XMAX : PRINT
  204. 1960 IF XMAX < .01 THEN 1950
  205. 1970 INPUT "            Driver Effective Diameter in inches";DIA : PRINT
  206. 1980 IF DIA < 1 THEN 1970
  207. 1990 INPUT "            How many drivers "; NUMDRVRS : PRINT
  208. 2000 IF NUMDRVRS<1 THEN 1990
  209. 2010 IF NUMDRVRS>1 THEN 2020 ELSE 2030
  210. 2020 DIA=2*(SQR(((PI*DIA/2)^2)*NUMDRVRS)/PI)
  211. 2030 IF DIA < 1 THEN 1970
  212. 2040 CLS
  213. 2050 THERMPWR=.01*EFF*PE   'midband thermal limit acoustic output power (Watts)
  214. 2060 PWL=10*LOG(THERMPWR)/LOG10+120
  215. 2070 XMAXM=XMAX/39.37    'Xmax in meters
  216. 2080 DIAM=DIA/39.37      'driver diameter in meters
  217. 2090 SDM=PI*DIAM^2/4     'driver area in square meters
  218. 2100 SD=PI*DIA^2/4       'driver area in inches
  219. 2110 VD=XMAX*SD          'driver volume displacement in cubic inches
  220. 2120 '
  221. 2130 DISPLACECONST=.4375*FS^4*(XMAXM*SDM)^2  'displ. acoustic output constant
  222. 2140 RETURN
  223. 2150 '
  224. 2160 '
  225. 2170 '======= drawing setup and response calculations =======
  226. 2180 FOR VB=VBMIN TO VBMAX STEP VBSTEP
  227. 2190    IF DEFAULT$<>"N" AND VB>19 THEN Q=3
  228. 2200    IF DEFAULT$<>"N" AND VB<19 THEN Q=5
  229. 2210    IF DEFAULT$<>"N" AND VB<11 THEN Q=7
  230. 2220  FOR FB=FBMIN TO FBMAX STEP FBSTEP
  231. 2230    IF OVERLAY$="N" OR OVERLAY$="n" THEN GOSUB 2650  'for graph setup
  232. 2240    IF OVERLAY$="N" OR OVERLAY$="n" THEN 2270
  233. 2250    IF DRAWCOUNTER=0 THEN GOSUB 2650  'for single graph setup
  234. 2260    DRAWCOUNTER=1
  235. 2270     A=(FB^2)/(FS^2)  'start response calculations
  236. 2280     B=(A/QTS)+(FB/(Q*FS))
  237. 2290     C=1+A+(FB/(Q*FS*QTS))+(VAS/VB)
  238. 2300     D=(1/QTS)+(FB/(Q*FS))
  239. 2310     FOR K=0 TO 50
  240. 2320             F=FREQ(K)/FS
  241. 2330             VENTRESP=F^4/SQR((F^4-(C*F^2)+A)^2+F^2*(B-D*F^2)^2)
  242. 2340             VENTRESP=20*LOG(VENTRESP)/LOG10
  243. 2350             VENTRESP=CINT(VENTRESP*10+.5)/10
  244. 2360             GOSUB 3170  'for drawing curve
  245. 2370         NEXT K
  246. 2380    IF CHOICE=5 THEN GOSUB 2490  'for displacement calculations
  247. 2390    IF OVERLAY$="N" OR OVERLAY$="n" THEN SHELL "PAUSE"
  248. 2400    IF OVERLAY$<>"N" AND FB=FBMAX AND VB=VBMAX THEN SHELL "PAUSE"
  249. 2410    NEXT FB
  250. 2420  NEXT VB
  251. 2430 CLS:SCREEN 0:WIDTH 80
  252. 2440 DRAWCOUNTER=0
  253. 2450 COLOR 15,1,9 :CLS
  254. 2460 RETURN
  255. 2470 '
  256. 2480 '
  257. 2490 '======= displacement limits calculations =======
  258. 2500 A=(FB^2)/(FS^2)
  259. 2510 B=(A/QTS)+(FB/(Q*FS))
  260. 2520 C=1+A+(FB/(Q*FS*QTS))+(VAS/VB)
  261. 2530 D=(1/QTS)+(FB/(Q*FS))
  262. 2540 FOR K=0 TO 50
  263. 2550   F=FREQ(K)/FS
  264. 2560   VENTRESP=F^8/((A-F^2)^2+(F*FB/(Q*FS))^2) 'mag. of displacement function
  265. 2570   DISPWR=DISPLACECONST*VENTRESP 'displacement limited output power
  266. 2580   VENTRESP=10*LOG(DISPWR/THERMPWR)/LOG10
  267. 2590   VENTRESP=CINT(VENTRESP*100)/100
  268. 2600   GOSUB 3170  'for drawing curve
  269. 2610   NEXT K
  270. 2620 RETURN
  271. 2630 '
  272. 2640 '
  273. 2650 '======= graph setup =======
  274. 2660 CLS :SCREEN 2   'high resolution B&W graphics
  275. 2670 IF CHOICE=4 THEN PRINT TAB(26);"Normalized Response"
  276. 2680 IF CHOICE=5 THEN PRINT TAB(13);"Displacement Limits and Normalized Response"
  277. 2690 PRINT " +5dB"
  278. 2700 IF LIMITS$="N" THEN GOSUB 3040 'no large-signal data printout
  279. 2710 IF LIMITS$="N" THEN GOTO 2900 'skip large-signal data printing
  280. 2720 IF OVERLAY$<>"N" THEN PRINT: PRINT: PRINT: GOTO 2780 'no vent data printout
  281. 2730 FBV=FB: VBV=VB: VDV=VD
  282. 2740 GOSUB 4530  'min vent area calculations
  283. 2750 PRINT TAB(63) "VENT:"
  284. 2760 PRINT TAB(64) "Area=";CINT(SV.MIN)
  285. 2770 PRINT TAB(64) USING"Diam.=###.#";SVMINDIAM
  286. 2780 PRINT TAB(64) USING"Length=###.#";LV
  287. 2790 PRINT "  0dB";TAB(63);" (";CINT(PWL);"dBPWL )"
  288. 2800 PRINT TAB(63);"DRIVER:"
  289. 2810 PRINT TAB(64);DRIVER$
  290. 2820 PRINT " -3dB";TAB(64);"Fs=";FS;"Hz"
  291. 2830 PRINT TAB(64);"Qts=";QTS
  292. 2840 PRINT TAB(64) USING"Vas=###.# ft^3";VAS
  293. 2850 PRINT " -6dB";TAB(64);"Eff=";EFF;"%"
  294. 2860 PRINT TAB(64);"Pe=";PE;"W"
  295. 2870 PRINT TAB(64);"Xmax=";XMAX;CHR$(34)
  296. 2880 PRINT TAB(64) USING"Diam=###.#";DIA
  297. 2890 PRINT "-10dB";TAB(64);"Vd=";CINT(VD);"in^3"
  298. 2900 PRINT TAB(63);"ENCLOSURE:"
  299. 2910 IF OVERLAY$<>"N" AND VOL$="N" THEN PRINT TAB(64);"Vb=";CINT(VB*10)/10;"ft^3"
  300. 2920 IF OVERLAY$<>"N" AND VOL$<>"N" THEN PRINT TAB(64);"Vb=";VBMIN;"-";VBMAX;"ft^3"
  301. 2930 IF OVERLAY$="N" THEN PRINT TAB(64);"Vb=";CINT(VB*100)/100;"ft^3"
  302. 2940 IF OVERLAY$<>"N" AND TUN$="N" THEN PRINT TAB(64);"Fb=";CINT(FB*10)/10;"Hz"
  303. 2950 IF OVERLAY$<>"N" AND TUN$<>"N" THEN PRINT TAB(64);"Fb=";FBMIN;"-";FBMAX;"Hz"
  304. 2960 IF OVERLAY$="N" THEN PRINT TAB(64);"Fb=";CINT(FB*10)/10;"Hz"
  305. 2970 PRINT TAB(64);"Qb=";Q
  306. 2980 PRINT "-15dB"
  307. 2990 PRINT TAB(10);"20     30      50         100        200   300     500 Hz"
  308. 3000 GOSUB 3310     'for drawing grid
  309. 3010 RETURN
  310. 3020 '
  311. 3030 '
  312. 3040 '======= no large-signal grid labels =======
  313. 3050 PRINT:PRINT:PRINT:PRINT
  314. 3060 PRINT "  0dB"
  315. 3070 PRINT TAB(63) "Driver:"
  316. 3080 PRINT TAB(64) DRIVER$
  317. 3090 PRINT " -3dB"; TAB(64) "Fs=";FS;"Hz"
  318. 3100 PRINT TAB(64) "Qts=";QTS
  319. 3110 PRINT TAB(64) "Vas=";VAS;"ft^3"
  320. 3120 PRINT " -6dB":PRINT:PRINT:PRINT
  321. 3130 PRINT "-10dB"
  322. 3140 RETURN
  323. 3150 '
  324. 3160 '
  325. 3170 '======= draw curve =======
  326. 3180 XL=44          'left edge of graph
  327. 3190 YB=172         'bottom edge of graph
  328. 3200 YT=12          'top edge of graph
  329. 3210 XR=494         'right edge of graph
  330. 3220 IF K=0 THEN DRAW "BM=XL; ,=YB;" 'first move to graph lower left corner
  331. 3230    X=9*K+XL
  332. 3240    X1=X+9
  333. 3250    IF VENTRESP<-15 THEN DRAW "BM=X1; ,=YB;":GOTO 3280 'move but don't draw
  334. 3260    Y=52-(VENTRESP*8)
  335. 3270    DRAW "C1;M=X; ,=Y;"
  336. 3280 RETURN
  337. 3290 '
  338. 3300 '
  339. 3310 '======= draw grid =======
  340. 3320 LINE(44,12)-(494,172),1,B  'draws box
  341. 3330 LINE(44,52)-(494,52),,,&HCCCC   'dashed 0 db ref line
  342. 3340 LINE(44,76)-(494,76),,,&HAAAA   'dotted -3db line
  343. 3350 LINE(44,100)-(494,100),,,&HAAAA   'dotted -6db line
  344. 3360 LINE(44,132)-(494,132),,,&HAAAA   'dotted -10db line
  345. 3370 'draw tick marks
  346. 3380 FOR Y=16 TO 168 STEP 8             '1/2db ticks
  347. 3390   LINE(42,Y)-(44,Y)
  348. 3400   NEXT Y
  349. 3410 FOR Y=20 TO 164 STEP 8             '1db ticks
  350. 3420   LINE(40,Y)-(44,Y)
  351. 3430   NEXT Y
  352. 3440 FOR Y=12 TO 172 STEP 40            '5db ticks
  353. 3450   LINE(40,Y)-(44,Y)
  354. 3460   NEXT Y
  355. 3470 FOR Z=20 TO 100 STEP 10
  356. 3480    X=LOG(Z/15)/LOG10*295.49299#+44
  357. 3490   LINE(X,172)-(X,12)
  358. 3500   NEXT Z
  359. 3510 FOR Z=200 TO 400 STEP 100
  360. 3520    X=LOG(Z/15)/LOG10*295.49299#+44
  361. 3530   LINE(X,172)-(X,12)
  362. 3540   NEXT Z
  363. 3550 FOR Z=25 TO 95 STEP 10
  364. 3560   X=LOG(Z/15)/LOG10*295.49299#+44
  365. 3570   LINE(X,172)-(X,169)
  366. 3580   NEXT Z
  367. 3590 FOR Z=150 TO 450 STEP 100
  368. 3600   X=LOG(Z/15)/LOG10*295.49299#+44
  369. 3610   LINE(X,172)-(X,169)
  370. 3620   NEXT Z
  371. 3630 '
  372. 3640 RETURN
  373. 3650 '
  374. 3660 '
  375. 3670 '======= vent design =======
  376. 3680 GOSUB 3800  'vent design data input
  377. 3690 GOSUB 4530  'min vent calculations
  378. 3700 PRINT :PRINT "                     Minimum Vent Area is";CINT(SV.MIN*10)/10;"square inches"
  379. 3710 SVMINDIAM = SQR(SV.MIN/PI)*2:SVMINDIAM=CINT(SVMINDIAM*10+.5)/10
  380. 3720 PRINT "                 The diameter of a tubular duct would be";CINT(SVMINDIAM*10)/10;"inches"
  381. 3730 PRINT "         Duct length is";CINT(LV*10)/10;"inches, tuning a";CINT(VBV*10)/10;"cubic foot box to";FBV;"Hz"
  382. 3740 VVMIN=SV.MIN*LV : VVVMIN=VVMIN/1728 : PRINT
  383. 3750 PRINT "           The duct volume is";CINT(VVMIN);"cubic inches or";CINT(VVVMIN*100)/100;"cubic feet."
  384. 3760 PRINT "          THIS VOLUME MUST BE ADDED TO THE DESIRED ENCLOSURE VOLUME."
  385. 3770 GOTO 3910  'vent menu
  386. 3780 '
  387. 3790 '
  388. 3800 '======= input vent design data =======
  389. 3810 CLS:PRINT:PRINT:PRINT:PRINT
  390. 3820 INPUT "            Box volume Vb in cubic feet";VBV : PRINT
  391. 3830 IF VBV < .001 THEN 3820
  392. 3840 INPUT "            Box tuning frequency Fb in Hz";FBV : PRINT
  393. 3850 IF FBV < .1 THEN 3840
  394. 3860 INPUT "            Driver displacement volume Vd in cubic inches";VDV
  395. 3870 IF VDV < .1 THEN 3860
  396. 3880 RETURN
  397. 3890 '
  398. 3900 '
  399. 3910 '======= vent design menu =======
  400. 3920 LOCATE 20,45: PRINT "     VENT DESIGN MENU    "
  401. 3930 '
  402. 3940 LOCATE 21,45: PRINT "  7  Change Vb or Fb     "
  403. 3950 LOCATE 22,45: PRINT "  8  Change Vent Area or Diameter   "
  404. 3960 LOCATE 23,45: PRINT "  9  Change Duct Length  "
  405. 3970 LOCATE 24,45: PRINT "  ENTER for Return to Main Menu "
  406. 3980 LOCATE 25,45: INPUT "  Your Choice";VENT.CHOICE
  407. 3990 IF VENT.CHOICE=7 THEN 3670
  408. 4000 IF VENT.CHOICE=8 THEN 4050
  409. 4010 IF VENT.CHOICE=9 THEN 4330
  410. 4020 RETURN
  411. 4030 '
  412. 4040 '
  413. 4050 '======= change vent area, find duct length =======
  414. 4060 IF SV.MIN=0 THEN GOSUB 3800 ELSE 4080  'input data if missing
  415. 4070 GOSUB 4530  'find minimum vent area
  416. 4080 CLS:PRINT :PRINT :PRINT :PRINT
  417. 4090 INPUT "            Are you entering vent area (A) or diameter (D)";CALC$        : PRINT
  418. 4100 IF CALC$="D" OR CALC$="d" THEN 4120 ELSE 4110
  419. 4110 IF CALC$="A" OR CALC$="a" THEN 4160 ELSE 4090
  420. 4120 INPUT "                 Vent diameter Dv in inches";SVDIAM : PRINT
  421. 4130 IF SVDIAM < 1 THEN 4120
  422. 4140 SV=PI*(SVDIAM/2)^2
  423. 4150 PRINT "             Vent area Sv is";CINT(SV*100)/100;"square inches" :         GOTO 4200 : PRINT
  424. 4160 INPUT "            Vent area Sv in square inches";SV : PRINT
  425. 4170 IF SV < 1 THEN 4160
  426. 4180 DV=SQR(SV/PI)*2
  427. 4190 PRINT "     The equivalent diameter of this area is";CINT(DV*10)/10;"inches"
  428. 4200 IF SV<SV.MIN THEN GOSUB 4650  'for warning message
  429. 4210 LV=SV/SV.LV-.825*SQR(SV)
  430. 4220 CUIN=SV*LV : CUIN=CINT(CUIN)
  431. 4230 CUFT=CUIN/1728 : CUFT=CINT(CUFT*100)/100 :PRINT
  432. 4240 PRINT "            Duct length is";CINT(LV*100)/100;"inches"
  433. 4250 PRINT "            Duct volume is ";CUIN;" cubic inches or ";CUFT;" cubic feet.
  434. 4260 PRINT "           THIS VOLUME MUST BE ADDED TO THE DESIRED ENCLOSURE VOLUME."
  435. 4270 PRINT "        Fb=";FBV;"Hz"
  436. 4280 PRINT "        Vb=";VBV;"cubic feet
  437. 4290 PRINT : PRINT : PRINT
  438. 4300 GOTO 3910
  439. 4310 '
  440. 4320 '
  441. 4330 '======= change duct length, find vent area =======
  442. 4340 IF SV.MIN=O THEN GOSUB 3800 ELSE 4360  'input data if missing
  443. 4350 GOSUB 4530  'find minimum vent area
  444. 4360 CLS: PRINT :PRINT :PRINT :PRINT
  445. 4370 INPUT "        Duct length in inches";LV
  446. 4380 IF LV < .75 THEN 4370
  447. 4390 IF LV<.75 THEN PRINT "    WARNING: DUCT LENGTH IS LESS THAN 3/4 INCH"
  448. 4400 SV=((SV.LV*.825+SQR((SV.LV*.825)^2+4*SV.LV*LV))/2)^2:SV=CINT(SV*10+.5)/10
  449. 4410 PRINT "        Vent area is";SV;"square inches"
  450. 4420 VENTDIAM = SQR(SV/PI)*2:VENTDIAM=CINT(VENTDIAM*10+.5)/10
  451. 4430 PRINT "        Vent diameter is";VENTDIAM;"inches" : PRINT
  452. 4440 CUIN=SV*LV : CUIN=CINT(CUIN)
  453. 4450 CUFT=CUIN/1728 : CUFT=CINT(CUFT*100)/100
  454. 4460 PRINT "        Duct volume is ";CUIN;" cubic inches or ";CUFT;" cubic feet.
  455. 4470 IF SV<SV.MIN THEN GOSUB 4650  'for warning message
  456. 4480 PRINT "        Fb=";FBV;"Hz"
  457. 4490 PRINT "        Vb=";VBV;"cubic feet"
  458. 4500 GOTO 3910
  459. 4510 '
  460. 4520 '
  461. 4530 '======= minimum vent size calculations =======
  462. 4540 'most accurate for ducts more than 2 inches long
  463. 4550 L=2350/(FBV^2*VBV)
  464. 4560 SV.MIN=8.25*VDV/(SQR(FBV))
  465. 4570 SV.LV=1728*VBV*(6.2832*FBV/13504)^2 'vent area-to-effective-length ratio
  466. 4580 LV=SV.MIN/SV.LV-.825*SQR(SV.MIN)
  467. 4590 IF LV<.75 THEN LV=.75 :                                                         SV.MIN=((SV.LV*.825+SQR((SV.LV*.825)^2+4*SV.LV*LV))/2)^2
  468. 4600 SVMINDIAM=SQR(SV.MIN/PI)*2
  469. 4610 LV=INT(LV*10^2+.5)/10^2
  470. 4620 RETURN
  471. 4630 '
  472. 4640 '
  473. 4650 '======= warning message =======
  474. 4660 PRINT: COLOR 7
  475. 4670 PRINT USING " WARNING this vent area is less than the desired minimum of ###.#";SV.MIN
  476. 4680 PRINT "  square inches as recommended in Small to keep air particle
  477. 4690 PRINT "  velocity in the vent below 2% of the speed of sound, for near-
  478. 4700 PRINT "  lossless system tuning.  Acceptably good results will be obtained
  479. 4710 PRINT "  by using one port per driver whose diameter is AT LEAST 1/3 that
  480. 4720 PRINT "  of the driver, or whose area is equal to a circle with that diameter.
  481. 4730 COLOR 15
  482. 4740 RETURN
  483. 4750 END
  484.