07 марта 2021

TAPER.BAS

 10  KEY OFF: CLS: PRINT: PRINT

20  PRINT"                            TAPER"

30  PRINT

40  PRINT"  Convert a cylindrical monopole or half-dipole element

50  PRINT"  into a practical element using telescoped tubing sections.

60  PRINT

70  PRINT"  Input the lengths and diameters of the inner sections,

80  PRINT"  and the diameter of the end section whose length is unknown.

90  PRINT

100 PRINT"  TAPER calculates the necessary length for the end section.

110 PRINT: PRINT: PRINT

120 ' From QST, October 1986.                This version by G3SEK, Jan 1987.

130 '

140 ' Initialize.

150 MAXPARTS% = 9

160 DIM PARTD(MAXPARTS%), PARTL(MAXPARTS%), LP(MAXPARTS%), F(MAXPARTS%)

170 DIM M(MAXPARTS%), THETA(MAXPARTS%+1)

180 '

190 ' Symbols are generally as used by Lawson in Ham Radio, December 1980

200 '

210 ' Define function DELTAX for differential reactance

220 '                      X for total reactance

230 ' CAPK (capital K) is wavelength/radius ratio

240 '

250 DEF FN DELTAX(CAPK) = -18.7 + LOG(CAPK) + 33.9

260 DEF FN X(CAPK) = 33.25 + 1.385 * LOG(CAPK) - .066 * LOG(CAPK)^2

270 ' NB  Functions use natural logs, so coefficients look unfamiliar.

280 '

290 '

300 ' Define constants

310 C = 11802.85        ' Speed of light in inches/microsecond

320 PIO2 = 2 * ATN(1)   ' pi / 2

330 '

340 '

350 ' Get basic design data and tubing dimensions.

360 '

370 INPUT"Frequency (MHz) : ",FREQ : LAMBDA = C / FREQ

380 PRINT: PRINT"Cylindrical monopole or half-dipole element -"

382 INPUT"Length (wl, or inches if >0.28)   : ",HOL

384 IF HOL>.28 THEN HOL = HOL/LAMBDA : T$ = "8ths" ELSE T$ = "wl"

386 PRINT "Diameter (";T$; : INPUT ") : ",DOL

388 IF T$="8ths" THEN DOL = DOL/(8*LAMBDA)

400 PRINT:PRINT"Practical telescoping element -"

410 PRINT"Number of parts (<=";MAXPARTS%;: INPUT")   : ",NPARTS%

420 IF NPARTS% > MAXPARTS% GOTO 410

430 PRINT"Starting from the inside...": FOR I% = 1 TO NPARTS%-1

440  PRINT"Part ";I%;: INPUT"  Length (inches) : ", PARTL(I%)

450  PRINT TAB(11);: INPUT"Diameter (8ths) : ", PARTD(I%)

460  PARTD(I%) = PARTD(I%) / 8

470  NEXT I%

480 PRINT"Part ";NPARTS%;"  Length unknown."

490 PRINT TAB(11);: INPUT"Diameter (8ths) : ", PARTD(NPARTS%): PRINT

500 PARTD(NPARTS%) = PARTD(NPARTS%) / 8

520 '

530 '

540 ' Alter half-dipole length according to diameter, from cylindrical design

550 ' value to geometric mean of largest and smallest tubing diameters.

560 '

570 AVGDIA = SQR(PARTD(1) * PARTD(NPARTS%))

580 ADOL = AVGDIA / LAMBDA

590 CAPK = 2 / DOL

600 ACAPK = 2 / ADOL

610 SML = 2 * HOL

620 ASML = .5 + (FNX(ACAPK) - FNX(CAPK) - 20*FNDELTAX(CAPK) * (.5 - SML)) / (20*FNDELTAX(ACAPK))

630 HAOL = ASML / 2

640 HA = HAOL * LAMBDA

650 '

660 '

670 ' Set up Lawson's M functions for each piece.

680 '

690 FOR I% = 1 TO NPARTS%

700  PDIA = PARTD(I%) / LAMBDA

710  CAPI = 2 / PDIA

720  M(I%) = FNDELTAX(CAPI) / FNDELTAX(ACAPK)

730  NEXT I%

740 '

750 '

760 ' Initial guess for length of end piece

770 '

780 PARTL(NPARTS%) = HA

790 FOR I% = 1 TO NPARTS% - 1

800  PARTL(NPARTS%) = PARTL(NPARTS%) - PARTL(I%)

810  NEXT I%

820 THETA(NPARTS%+1) = PIO2

830 '

840 ' To compute the telescoping element which is equivalent to the

850 ' original cylinder, adjust the length of the end piece

860 ' proportionally to the error between the target length HA and

870 ' the computed length.

880 ' Iterate in WHILE-WEND loop until the error is small enough.

890 '

900 DELTA = 1

910 WHILE ABS(DELTA) > .00001*HA

920 '

930 '

940 ' Find overall length of telescoping half-dipole element, in radians.

950 '

960  S = 0

970   FOR I% = 1 TO NPARTS%

980    S = S + PARTL(I%)

990    THETA(I%) = 0

1000   NEXT I%

1010  SRAD = S / PIO2

1020 '

1030 '

1040 ' Find positions of joints, in radians.

1050 '

1060  FOR I% = 2 TO NPARTS%

1070   THETA(I%) = THETA(I%-1) + PARTL(I%-1) / SRAD

1080   NEXT I%

1090 '

1100 '

1110 ' Calculate Lawson's F function, and

1120 ' determine the equivalent length of each piece.

1130 '

1140  FOR I% = 1 TO NPARTS%

1150   F(I%) = (SIN(2*THETA(I%+1)) - SIN(2*THETA(I%))) / (2 * (THETA(I%+1) - THETA(I%)))

1160   LP(I%) = PARTL(I%) * (M(I%) + 1/M(I%) + (M(I%) - 1/M(I%)) * F(I%)) / 2

1170   NEXT I%

1180 '

1190 '

1200 ' Find the error between the sum of the piece lengths

1210 ' and the target length HA.

1220 '

1230  DELTA = HA

1240  FOR I% = 1 TO NPARTS%

1250   DELTA = DELTA - LP(I%)

1260   NEXT I%

1310  PARTL(NPARTS%) = PARTL(NPARTS%) + M(NPARTS%) * DELTA

1320  WEND

1330 '

1340 ' Show the results, and then return to do another

1350 ' cylindrical element length.

1360 '

1370 PRINT USING" Length of end piece = +###.## inches "; PARTL(NPARTS%)

1380 IF PARTL(NPARTS%)<0 THEN PRINT"Shorten the inner sections!": GOTO 400

1382 TOTL = 0 : FOR I% = 1 TO NPARTS% : TOTL = TOTL + PARTL(I%) : NEXT I%

1384 PRINT USING"        Total length =  ###.## inches"; TOTL

1386 PRINT USING"Change (taper - cyl) = +##.### inches"; (TOTL - HOL*LAMBDA)

1390 PRINT

1400 PRINT"New Cylindrical length, new Telescoping arrangement, or Quit?"

1410 PRINT"Press C, T or Q  >"; : ANS$ = INPUT$(1) : PRINT

1420 ANS% = INSTR("TtQqCc",ANS$): IF ANS%=0 GOTO 1410

1430 IF ANS%=1 OR ANS%=2 GOTO 400

1440 IF ANS%=3 OR ANS%=4 THEN END

1450 INPUT"Cylindrical half-length (wl, or inches if >0.28)   : ",HOL

1460 IF HOL>.28 THEN HOL = HOL/LAMBDA

1470 GOTO 610