07 марта 2021

VPATTERN.BAS

 10   REM       PHASED ANTENNA PATTERN DISPLAY PROGRAM (IBM PC)

20   REM     --COMPUTES PHASED VERTICAL PATTERNS, DISPLAYS THEM

30   REM       AND PRINTS A HARD COPY OF BOTH PATTERNS AND DATA.

36   REM       BY KC6A AND N6NB; (C) 1983 BY HAYDEN BOOK CO.,INC.

38   KEY OFF:CLS

40   PRINT:PRINT  TAB(20)"PHASED VERTICAL ARRAY"

50   PRINT TAB(17)"DIRECTIONAL PATTERN DISPLAY": PRINT:PRINT

60   INPUT "DO YOU WANT A HARD COPY, INCLUDING TABLES?  (Y/N) : ",HC$

70   DEF FNM(X)=X-2* INT (X/2)

80   TM=80:OF=60

90   C=.0174553

100  IF HC$<>"Y" THEN TM=1

140  PRINT:PRINT

150  PRINT "CHOOSE ONE ANTENNA AS THE REFERENCE."

160  PRINT "THEN SPECIFY THE POSITION AND PHASING"

170  PRINT "OF OTHER ANTENNAS IN RELATION TO IT."

175  PRINT:PRINT

180  INPUT "HOW MANY ANTENNAS IN THE ARRAY?  : ",N

280  DIM G$(40,40)

290  FOR TX=0 TO 39

300  FOR TY=0 TO 39

310  G$(TX,TY)=" "

320  NEXT TY:NEXT TX

330  G$(20,20)="1"

350  DIM AZ(N),SP(N),PH(N),EI(N),HT(N)

390  PRINT:PRINT "ENTER THE ELECTRICAL HEIGHT OF REFERENCE,"

392  PRINT "IN DEGREES  (NOTE: A 1/4-WAVE VERTICAL IS 90 DEGREES)."

394  INPUT " DEGREES?  : ",HT(1)

396  IF HT(1)>360 THEN PRINT "TOO MANY.  360 MAX.":GOTO 390

400  D=10:AZ(1)=0:SP(1)=E:PH(1)=0:EI(1)=1

410  PRINT:PRINT

420  MM=1

430  IF N=1 THEN 520

440  FOR I=2 TO N

450  PRINT:PRINT: PRINT  TAB(10)"DESCRIBE ANTENNA NO. ";I: PRINT

460  PRINT:PRINT "DIRECTION FROM REFERENCE IN DEGREES AZIMUTH?"

462  INPUT "(0 = NORTH, 180 = SOUTH, ETC.)  : ", AZ(I)

470  PRINT:PRINT "SPACING FROM REFERENCE IN DEGREES?"

472  INPUT "(1/4 WAVELENGTH = 90)  : " ;SP(I)

480  PRINT:INPUT "PHASE FROM REFERENCE IN DEGREES  : ",PH(I)

490  PRINT: PRINT "INPUT POWER RELATIVE TO REFERENCE ANT? "

492  INPUT "IF SAME AS REFERENCE, ENTER 1...  : ",EI(I)

500  MM=MM+EI(I)

510  PRINT: INPUT "ELECTRICAL HEIGHT, DEGREES?  : ",HT(I):  NEXT

520  IF HC$="Y" THEN GOSUB 960

530  PRINT:PRINT

570  TX=80:TY=80

600  IF HC$<>"Y" THEN 690

620  LPRINT TAB(14)"RELATIVE FIELD STRENGTH CALCULATIONS"

630  FOR Q=1 TO 64:LPRINT"-";:NEXT Q

650  LPRINT

660  LPRINT  TAB(16)"FIELD STRENGTH AT ELEVATION ANGLE"

670  LPRINT "      0      10     20     30     40     50     60     70     80"

680  LPRINT "AZ.  ----   ----   ----   ----   ----   ----   ----   ----   ----"

690  FOR I=0 TO 359 STEP D

700  IF HC$<>"Y" THEN 720

710  LPRINT I;TAB(6);

720  FOR T=0 TO TM STEP 10

730  SX=0:SY=0

740  FOR M=1 TO N

750  GOSUB 1100

760  NEXT M

770  RF=SQR(SX*SX+SY*SY)

780  IF T=0 THEN GOSUB 1200

790  GOSUB 1150

800  NEXT T

810  IF HC$="Y" THEN LPRINT

820  NEXT I

840  IF N=1 THEN 905

850  FOR I=2 TO N

860  M=SP(I)/360

870  TX=INT(COS(AZ(I)*C)*M*76+82):TY=INT(SIN(AZ(I)*C)*M*76+82)

880  TX=INT(TX/4):TY=INT(TY/4)

890  G$(TX,TY)=STR$ (I)

900  NEXT I

905  GOSUB 2000

910  IF HC$="Y" THEN  GOSUB 1320

930  PRINT  CHR$ (7)

950  END

960  LPRINT

970  LPRINT  TAB(10)"ANTENNA PATTERN FOR PHASED VERTICALS": LPRINT

980  LPRINT "ANT  AZ  SPACING  REL PH  REL PWR  HEIGHT"

990  LPRINT

1000 FOR K=1 TO N

1010 LPRINT  TAB(2)K; TAB(6) AZ(K);

1020 LPRINT TAB(12) SP(K);

1030 LPRINT TAB(21) PH(K);

1040 LPRINT TAB(30) EI(K);

1050 LPRINT TAB(38) HT(K)

1060 NEXT K

1070 LPRINT

1090 RETURN

1100 A1=AZ(M)*C:AA=I*C:P1=PH(M)*C:V=HT(M)*C

1110 EL=T*C:NU=COS(V*SIN(EL))-COS(V):DN=COS(EL)*(1-COS(V))

1120 F0=NU/DN:EF=F0*EI(M)

1130 BK=SP(M)*C* COS(A1-AA)+P1:X=EF*COS(BK):Y=EF*SIN (BK)

1140 SX=SX+X:SY=SY+Y: RETURN

1150 RF=INT(100*RF+.5)/100

1160 IF HC$<>"Y" THEN  RETURN

1170 RS$=STR$(RF)

1180 LPRINT RS$; SPC(7-LEN(RS$));

1190 RETURN

1200 TX=RF/MM*19*COS(AA)+20

1210 TY=RF/MM*19*SIN(AA)+20

1240 IF INT(TX+.5)<>20 THEN 1290

1250 IF INT(TY+.5)=20 THEN  RETURN

1290 TX=INT(TX):TY=INT(TY)

1300 G$(TX,TY)="*"

1310 RETURN

1320 LPRINT  CHR$(12): REM  FORM FEED

1330 LPRINT:LPRINT:LPRINT  TAB(34)"PATTERN PLOT"

1340 LPRINT:LPRINT TAB(40)"0"

1350 FOR TX=39 TO 0 STEP -1

1360 IF TX=20 THEN 1390

1370 LPRINT "          ";

1380 GOTO 1400

1390 LPRINT "       270";

1400 FOR TY=0 TO 39

1410 LPRINT G$(TX,TY);: IF FNM(TY)=1 THEN  LPRINT " ";

1420 NEXT TY

1430 IF TX<>20 THEN 1450

1440 LPRINT "90": GOTO 1460

1450 LPRINT

1460 NEXT TX

1470 LPRINT  TAB(39)"180"

1480 LPRINT:LPRINT:LPRINT

1500 RETURN

2000 PRINT:PRINT TAB(27)"PATTERN PLOT"

2010 PRINT:PRINT TAB(34)"0"

2020 FOR TX=39 TO 0 STEP -1

2030 IF TX=20 THEN 2060

2040 PRINT "   ";

2050 GOTO 2070

2060 PRINT "270";

2070 FOR TY=0 TO 39

2080 PRINT G$(TX,TY);:IF FNM(TY)=1 THEN PRINT " ";

2090 NEXT TY

2100 IF TX<>20 THEN 2120

2110 PRINT "90":GOTO 2130

2120 PRINT

2130 NEXT TX

2140 PRINT TAB(33)"180"

2150 RETURN