home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
genie-commodore-file-library
/
C64Software
/
ANTENNA-SCALE
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
7KB
|
205 lines
10 REM PARASITIC ANTENNA SCALING PROGRAM (C64)
20 REM FOR ANY QUAD, YAGI OR QUAGI OF TWO OR MORE ELEMENTS.
30 OPEN15,8,15
40 OPEN13,4:REM VIC PRINTER
50 DIM A(25),E(25):B2=0:CM=2.54
60 CLS$=CHR$(147):REM CLEAR-SCREEN COMMAND
70 PRINT CLS$
80 INV$=CHR$(18):REM VIDEO-INVERSE COMMAND
90 NML$=CHR$(146):REM VIDEO-NORMAL COMMAND
100 PRINT " ";INV$;" "
110 PRINT " ";INV$;" ANTENNA SCALING PROGRAM "
120 PRINT " ";INV$;" ":PRINT NML$
130 PRINT " HERE ARE YOUR OPTIONS--"
140 PRINT " ENTER DIMENSIONS AND SCALE THEM"
150 PRINT " TO A NEW FREQUENCY NOW (SCALE)"
160 PRINT " CREATE A DATA FILE WITH STANDARD"
170 PRINT " DIMENSIONS TO USE LATER (CREATE)"
180 PRINT " READ DATA FROM A FILE AND SCALE IT"
190 PRINT " TO A NEW FREQUENCY (READ)"
200 PRINT:PRINT " ENTER 'SCALE','CREATE' OR 'READ'":INPUT O$
210 IF O$="READ" THEN GOSUB1920:GOTO550
220 IF O$<>"CREATE" THEN IF O$<>"SCALE" THEN130
230 REM DATA ENTRY SECTION
240 PRINT CLS$:REM CLEAR SCREEN
250 PRINT:PRINT
260 PRINT " ENTER THE DIMENSIONS "
270 PRINT " FOR THE ORIGINAL ANTENNA "
280 PRINT:PRINT:PRINT "HOW MANY DIRECTORS (IF NONE,'0')":INPUT N
290 IF N>25 THEN PRINT "TOO MANY. 25 MAXIMUM":GOTO280
300 IF N<1 THEN360
310 FOR J=1 TO N
320 PRINT:PRINT "ENTER THE LENGTH (IN INCHES)"
330 PRINT " OF DIRECTOR #";J;
340 INPUT E(J)
350 NEXT J
360 PRINT:PRINT "HOW LONG IS THE DRIVEN ELEMENT":INPUT D:PRINT
370 PRINT "HOW LONG IS THE REFLECTOR":INPUT R:PRINT:PRINT:PRINT
380 PRINT:PRINT
390 PRINT " NOW ENTER THE ELEMENT SPACING ":PRINT
400 PRINT:PRINT:INPUT "REFLECTOR TO DRIVEN ELEMENT";B1
410 IF N<1 THEN480
420 PRINT:INPUT "DRIVEN ELEMENT TO DIRECTOR #1";B2
430 IF N<2 THEN480
440 FOR J=1 TO (N-1)
450 PRINT:PRINT "DIRECTOR #";J;"TO DIRECTOR #";J+1
460 INPUT A(J)
470 NEXT J
480 PRINT:PRINT "WHAT IS THE ORIGINAL FREQUENCY (IN MHZ)":INPUT F1
490 PRINT:PRINT "WHAT IS THE ELEMENT DIAMETER (INCHES)"
500 PRINT "(USE TYPICAL DIAMETER IF IT VARIES)"
510 INPUT R1
520 IF O$="CREATE" THEN1710
530 REM INFORMATION NEEDED TO SCALE TO A NEW FREQUENCY
540 PRINT
550 PRINT:PRINT " NOW DESCRIBE THE NEW ANTENNA "
560 PRINT:INPUT "ENTER THE NEW FREQUENCY (IN MHZ)";F2
570 SF=F1/F2:REM SCALING FACTOR
580 PRINT:PRINT "DO YOU WANT THE DIMENSIONS CORRECTED"
590 PRINT "FOR LENGTH-TO-DIAMETER RATIO (Y/N)":INPUT A$
600 IF A$<>"Y" THEN630
610 PRINT :PRINT "WHAT IS THE NEW ELEMENT DIAMETER"
620 INPUT "(IN INCHES)";R2
630 IF SF<1.25 AND S>.8 THEN810
640 PRINT CLS$:REM CLEAR SCREEN
650 PRINT:PRINT
660 PRINT:PRINT
670 PRINT "****************************************"
680 PRINT " WARNING "
690 PRINT "****************************************"
700 PRINT:PRINT:PRINT NML$:REM VIDEO NORMAL
710 PRINT "SCALING ANTENNAS MATHEMATICALLY IS A"
720 PRINT "TRICKY BUSINESS. THERE ARE NUMEROUS"
730 PRINT "VARIABLES THAT AFFECT THE OUTCOME. IF"
740 PRINT "THE CHANGE IN FREQUENCY IS SMALL, THEY"
750 PRINT "MAY BE IGNORED. BUT WHEN A TWO-TO-ONE"
760 PRINT "OR GREATER CHANGE IS INVOLVED, SOME"
770 PRINT "EXPERIMENTATION WILL BE NECESSARY, EVEN"
780 PRINT "IF LENGTH-TO-DIAMETER RATIO IS TAKEN"
790 PRINT "INTO ACCOUNT IN THE SCALING."
800 PRINT:PRINT:PRINT
810 PRINT:PRINT "DO YOU WANT A HARD COPY PRINTOUT? (Y/N)":INPUT LP$
820 X=R2/R1
830 L1=D/(.975-.6*R1/D)
840 L2=L1*SF
850 L3=L2*(.975-.6*R2/L2)
860 S=L3/D
870 IF A$<>"Y" THEN S=SF
880 REM DISPLAY AND PRINTOUT OF RESULTS
890 PRINT CLS$:REM CLEAR SCREEN
900 PRINT:PRINT
910 DEF FNA(X)=INT(X*100+.5)/100
920 DEF FNB(X)=INT(S*X*100+.5)/100
930 DEF FNC(X)=INT(CM*S*X*100+.5)/100
940 DEF FND(X)=INT(SF*X*100+.5)/100
950 GOSUB1000:REM VIDEO DATA DISPLAY
960 IF LP$<>"Y" THEN1880
970 GOSUB1360:REM PRINTING SUBROUTINE
980 GOTO1880
990 REM VIDEO DISPLAY
1000 PRINT "ANTENNA SCALING FROM ";F1;" TO ";F2;"MHZ"
1010 PRINT
1020 IF O$="READ" THEN PRINT TAB(9)"ANTENNA TYPE ";FILE$:PRINT
1030 F1$="ELE ORIG L(IN) NEW L(IN) NEW L(CM)"
1040 PRINT F1$:PRINT
1050 PRINT "REFL";SPC(10-LEN(STR$(FNA(R))));FNA(R);
1060 PRINT SPC(12-LEN(STR$(FNB(R))));FNB(R);SPC(11-LEN(STR$(FNC(R))));FNC(R)
1070 PRINT "DE";SPC(12-LEN(STR$(FNA(D))));FNA(D);SPC(12-LEN(STR$(FNB(D))));
1080 PRINT FNB(D);SPC(11-LEN(STR$(FNC(D))));FNC(D)
1090 IF N<1 THEN1160
1100 FOR J=1 TO N
1110 PRINT "DIR";SPC(11-LEN(STR$(FNA(E(J)))));FNA(E(J));
1120 PRINT SPC(12-LEN(STR$(FNB(E(J)))));FNB(E(J));
1130 PRINT SPC(11-LEN(STR$(FNC(E(J)))));FNC(E(J))
1140 NEXT J
1150 AA$="":INPUT "<CR> TO CONTINUE";AA$
1160 PRINT:PRINT
1170 PRINT TAB(7) "INTER-ELEMENT SPACING DATA":PRINT
1180 F4$="ELE ORIG SPACING (IN) NEW (IN)"
1190 PRINT F4$:PRINT
1200 PRINT "REF-DE";SPC(15-LEN(STR$(FNA(B1))));FNA(B1);
1210 PRINT SPC(16-LEN(STR$(FND(B1))));FND(B1)
1220 IF N<1 THEN1300
1230 PRINT "DE-D1";SPC(16-LEN(STR$(FNA(B2))));FNA(B2);
1240 PRINT SPC(16-LEN(STR$(FND(B2))));FND(B2)
1250 IF N<2 THEN1300
1260 FOR J=1 TO N-1
1270 PRINT "D";J;"-D";J+1;SPC(12-LEN(STR$(FNA(A(J)))));FNA(A(J));
1280 PRINT SPC(16-LEN(STR$(FND(A(J)))));FND(A(J))
1290 NEXT J
1300 PRINT:PRINT
1310 IF A$="Y" THEN PRINT "LENGTH-TO-DIAMETER RATIO CORRECTED"
1320 PRINT:PRINT "NOTE: MATHEMATICALLY DERIVED DIMENSIONS"
1330 PRINT "MAY REQUIRE FINE TUNING IN THE FIELD."
1340 RETURN
1350 REM HARD COPY PRINTOUT
1360 PRINT#13,"";SPC(14)"ANTENNA SCALING FROM ";F1;" TO ";F2;"MHZ"
1370 PRINT#13,"":PRINT#13,""
1380 IF O$="READ" THEN PRINT#13,"";SPC(22)"ANTENNA TYPE ";FILE$:PRINT#13,""
1390 PRINT#13,F1$:PRINT#13,""
1400 PRINT#13,"REFL";SPC(10-LEN(STR$(FNA(R))));FNA(R);
1410 PRINT#13,"";SPC(12-LEN(STR$(FNB(R))));FNB(R);
1420 PRINT#13,"";SPC(12-LEN(STR$(FNC(R))));FNC(R)
1430 PRINT#13,"DE";SPC(12-LEN(STR$(FNA(D))));FNA(D);
1440 PRINT#13,"";SPC(12-LEN(STR$(FNB(D))));FNB(D);
1450 PRINT#13,"";SPC(12-LEN(STR$(FNC(D))));FNC(D)
1460 IF N<1 THEN1520
1470 FOR J=1 TO N
1480 PRINT#13,"DIR";SPC(11-LEN(STR$(FNA(E(J)))));FNA(E(J));
1490 PRINT#13,"";SPC(12-LEN(STR$(FNB(E(J)))));FNB(E(J));
1500 PRINT#13,"";SPC(12-LEN(STR$(FNC(E(J)))));FNC(E(J))
1510 NEXT J
1520 PRINT#13,"":PRINT#13,"":PRINT#13,""
1530 PRINT#13,"";SPC(19) "INTER-ELEMENT SPACING DATA":PRINT#13,""
1540 PRINT#13,F4$:PRINT#13,""
1550 PRINT#13,"REF-DE";SPC(15-LEN(STR$(FNA(B1))));FNA(B1);
1560 PRINT#13,"";SPC(16-LEN(STR$(FND(B1))));FND(B1)
1570 IF N<1 THEN1650
1580 PRINT#13,"DE-D1";SPC(16-LEN(STR$(FNA(B2))));FNA(B2);
1590 PRINT#13,"";SPC(16-LEN(STR$(FND(B2))));FND(B2)
1600 IF N<2 THEN1650
1610 FOR J=1 TO N-1
1620 PRINT#13,"D";J;"-D";J+1;SPC(12-LEN(STR$(FNA(A(J)))));FNA(A(J));
1630 PRINT#13,"";SPC(16-LEN(STR$(FND(A(J)))));FND(A(J))
1640 NEXT J
1650 PRINT#13,"":PRINT#13,""
1660 IF A$="Y" THEN PRINT#13," LENGTH-TO-DIAMETER RATIO CORRECTED"
1670 PRINT#13,:PRINT#13," NOTE: MATHEMATICALLY DERIVED DIMENSIONS"
1680 PRINT#13," MAY REQUIRE FINE TUNING IN THE FIELD."
1690 FOR J=1 TO 1999:PRINT;:NEXT J:RETURN
1700 REM CREATING A NEW DATA FILE FOR A SPECIFIC ANTENNA DESIGN
1710 PRINT:PRINT:PRINT "GIVE YOUR DATA FILE A NAME--8 CHARS MAX"
1720 PRINT "PREFERABLY ONE DESCRIBING THE ANTENNA."
1730 PRINT "THE FIRST CHARACTER MUST NOT BE A NUMERAL."
1740 INPUT "--NAME";FILE$
1750 IF LEN(FILE$)>8 THEN PRINT "TOO LONG":GOTO1710
1760 PRINT#15,"S0:"+FILE$
1770 OPEN3,8,3,FILE$+",S,W"
1780 PRINT#3,N
1790 IF N<1 THEN1810
1800 FOR J=1 TO N:PRINT#3,E(J):NEXT J
1810 PRINT#3,D;",";R
1820 PRINT#3,B1;",";B2
1830 IF N<2 THEN1850
1840 FOR J=1 TO N-1:PRINT#3,A(J):NEXT J
1850 PRINT#3,F1:PRINT#3,R1
1860 CLOSE3
1870 PRINT:PRINT "NEW FILE CREATED"
1880 CLOSE13:CLOSE15:END
1890 REM READING AN EXISTING DATA FILE--
1900 REM THE FILE HAS TO BE ON THE LOGGED DISK DRIVE AND THE
1910 REM NAME ENTERED MUST MATCH THE FILE NAME.
1920 PRINT:PRINT "ENTER THE NAME OF THE DATA FILE TO USE":INPUT FILE$
1930 OPEN3,8,3,FILE$+",S,R"
1940 INPUT#15,EA,EB$,EC,ED:IF EA<20 THEN1960
1950 IF EA=62 THEN PRINT EB$:CLOSE3:GOTO1920
1960 INPUT#3,N
1970 IF N<1 THEN1990
1980 FOR J=1 TO N:INPUT#3,E(J):NEXT J
1990 INPUT#3,D,R:INPUT#3,B1,B2
2000 IF N<2 THEN2020
2010 FOR J=1 TO N-1:INPUT#3,A(J):NEXT J
2020 INPUT#3,F1:INPUT#3,R1
2030 CLOSE3
2040 RETURN