home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / rtty / k5ijsupr / power.bas < prev    next >
BASIC Source File  |  1987-03-09  |  7KB  |  189 lines

  1.     COLOR 15,1
  2.     CLS
  3.     PRINT STRING$(80,"=");
  4.     PRINT "This program is of particular interest to you if you are designing"
  5.     PRINT "an antenna system for an amateur or a commercial installation."
  6.     PRINT "You will be able to compare various combinations of antenna/"
  7.     PRINT "feedline types to obtain the most practical effective radiated"
  8.     PRINT "power for the type of antenna or feedline in progam A."
  9.     PRINT "Program B allows you to determine how much loss in DB can be"
  10.     PRINT "allowed for a particular effective radiated power output."
  11.     PRINT STRING$(80,"=");
  12.     INPUT "Do you want to run program A OR B";A$
  13.     CLS
  14.     PRINT STRING$(80,"=");
  15.     IF A$="B" OR A$="b" THEN GOTO PGMB
  16. START:
  17.     PRINT "This program computes the effective radiated power"
  18.     PRINT :
  19.     PRINT "as well as the feedline loss of any transmitter-"
  20.     PRINT
  21.     PRINT "antenna system. Based on transmitter output power,"
  22.     PRINT
  23.     PRINT "feedline and antenna efficiency"
  24.     PRINT STRING$(80,"=");
  25.     PRINT
  26.     PRINT
  27.     INPUT "Do you need instructions";A$
  28.     IF LEFT$(A$,1)="Y" OR LEFT$(A$,1)="y" THEN GOTO INSTRUCTIONS
  29.     GOSUB COAXTABLE
  30. RESTART:
  31.     CLS
  32.     INPUT "What is the transmitter output power";XMITTERPOWER
  33.     PRINT
  34.     PRINT
  35.     INPUT "How many feet of feedline do you plan to use";FEEDLINELENGTH
  36.     IF LINELOSS<>0 THEN GOTO GETGAIN
  37.     PRINT
  38.     PRINT
  39.     INPUT "What is the loss in DB per 100 Ft. of feedline";LINELOSS
  40. GETGAIN:
  41.     PRINT:PRINT:INPUT "What is the gain of your antenna system in DB (if unity gain, ENTER 0)";ANTENNAGAIN
  42.     ' CALCULATE TOTAL LOSS
  43.     L=FEEDLINELENGTH/100*LINELOSS
  44.     DBCABLELOSS=L
  45.     GOSUB CALCLOSS
  46.     POWERTOANTENNA=P1
  47.     ' CALC ERP AFTER DETERMINING HOW MUCH POWER GOES TO ANT
  48.     POWERLOSSOFCABLE=XMITTERPOWER-P1
  49.     L=ANTENNAGAIN
  50.     GOSUB CALCLOSS
  51.     CLS
  52.     PRINT "Transmitter output power......................";XMITTERPOWER;"Watts
  53.     PRINT
  54.     PRINT "Feedline length...............................";FEEDLINELENGTH;"Feet"
  55.     PRINT
  56.     PRINT "Loss per 100 Ft...............................";LINELOSS;"Decibels"
  57.     PRINT
  58.     PRINT "db loss of entire cable run...................";DBCABLELOSS;"Decibels"
  59.     PRINT
  60.     PRINT "Power loss of entire cable run................";POWERLOSSOFCABLE;"Watts"
  61.     PRINT
  62.     PRINT "Power delivered to antenna....................";POWERTOANTENNA;"Watts"
  63.     PRINT
  64.     PRINT "Effective radiated power......................";E;"WATTS
  65.     PRINT
  66.     LINELOSS=0
  67.     INPUT "Do you want another calculation";A$
  68.     IF LEFT$(A$,1)="Y" OR LEFT$(A$,1)="y" THEN GOSUB COAXTABLE:GOTO RESTART
  69.     GOTO FINISH
  70. INSTRUCTIONS:
  71.     CLS
  72.     PRINT STRING$(80,"=");
  73.     PRINT "You will be asked to enter various operating parameters"
  74.     PRINT "of your proposed transmitting system. These will be
  75.     PRINT "transmitter output power, length of feedline, feedline
  76.     PRINT "loss at operating frequency in db per 100 Ft., and antenna"
  77.     PRINT "gain in db."
  78.     PRINT "Enter All frequencies in MHz. For your convenience, an abbreviat-"
  79.     PRINT "ed table of more common coax types and losses is given."
  80.     PRINT "Use this table, or any similar table for"
  81.     PRINT "your calculations.  An option which allows you to determine the"
  82.     PRINT "value from the table is also included"
  83.     PRINT STRING$(80,"=");
  84.     PRINT
  85.     PRINT
  86.     INPUT "Press <ENTER> to continue......";A$
  87.     GOSUB COAXTABLE
  88.     GOTO RESTART
  89. COAXTABLE:
  90.     CLS
  91.     PRINT "Losses in db of commonly used coaxial cable in db per 100 Ft."
  92.     PRINT
  93.     PRINT
  94.     GOSUB TABLE1
  95.     GOTO NEEDINTER
  96. TABLE1:
  97.     PRINT "TYPE      1 MHz     10 MHz   100 MHz    400 MHz   1000 MHz"
  98.     PRINT "RG-8       .16       .55     2.0         4.5       8.5"
  99.     PRINT "RG-11      .18       .62     2.2         4.7       8.5"
  100.     PRINT "RG-17      .06       .24      .95        2.4       4.4"
  101.     PRINT "RG-58      .38      1.4      5.2        11.2      20.0"
  102.     PRINT "RG-59      .30      1.1      3.8         8.5      14.0"
  103.     RETURN
  104. NEEDINTER:
  105.     PRINT
  106.     PRINT "Values for other frequencies may be obtained by interpolation."
  107.     INPUT "Do you need to interpolate from the table";A$
  108.     IF LEFT$(A$,1)="Y" OR LEFT$(A$,1)="y" THEN GOSUB INTERPOLATE
  109.     RETURN
  110. CALCLOSS:
  111.     ' CALC ACTUAL LOSS FROM DB VALUES
  112.     ' 1ST OBTAIN LOG FROM DB BY DIV/10
  113.     L=L/10
  114.     ' ANTILOG OF L
  115.     AL=10^L
  116.     P1=XMITTERPOWER/AL
  117.     E=AL*POWERTOANTENNA
  118.     RETURN
  119. INTERPOLATE:
  120.     ' INTERPOLATION ROUTINE
  121.     CLS
  122.     PRINT
  123.     PRINT
  124.     INPUT "What is operating frequency";OF
  125.     CLS
  126.     GOSUB TABLE1
  127.     INPUT "What is closest frequency below operating frequency listed in table";LF
  128.     INPUT "What is the next higher frequency listed";HF
  129.     INPUT "Give loss at next lower frequency";DBCABLELOSS
  130.     INPUT "Give loss at next higher frequency";L2
  131.     FD=HF-LF
  132.     LD=L2-DBCABLELOSS
  133.     OD=OF-LF
  134.     OL=OD*LD/FD
  135.     LINELOSS=OL+DBCABLELOSS
  136.     PRINT
  137.     PRINT "Loss of transmission line at";OF;"MHz IS";LINELOSS;"db/100 Ft."
  138.     INPUT"Press <ENTER> to continue............";XX$
  139.     CLS
  140.     RETURN
  141. FINISH:
  142.     GOTO BYE
  143. PGMB:
  144.     PRINT " The first part of this section allows you to enter the trans-":PRINT"mitter output power and the effective radiated power you desire.":PRINT"YOU WILL THEN GET THE GAIN NEEDED TO OBTAIN THIS ERP."
  145.     PRINT"In the second part, you will enter the power that you
  146.     PRINT STRING$(80,"=");
  147.     INPUT "Do you want to find required system gain (1) or maximum allowable feedline loss (2)";T
  148.     INPUT "What is your transmitter power output power";P1
  149.     IF T=2 THEN GOTO GETPOWER
  150.     INPUT "What is your desired effective radiated power";E
  151.     GOSUB CALCPOWER
  152.     GOTO PRINTGAIN
  153. CALCPOWER:
  154.     EL=E/P1
  155.     D=10*(LOG(EL)/LOG(10))
  156.     RETURN
  157. PRINTGAIN:
  158.     CLS
  159.     PRINT "The required gain of your system is";D;"DB."
  160.     GOTO RUNAGAIN
  161. GETPOWER:
  162.     E=0:INPUT "How much power do you expect to deliver to the antenna";E
  163.     GOSUB CALCPOWER
  164.     CLS
  165.     PRINT "The maximum allowable feedline loss to maintain";E;"Watts to"
  166.     PRINT"the antenna with a transmitter power output of";P1;"is";D;"db."
  167. RUNAGAIN:
  168.     PRINT
  169.     PRINT
  170.     PRINT
  171.     PRINT
  172.     PRINT
  173.     INPUT "Do you want to run the (1) ERP program or(2) The maximum loss program or (3) terminate this session";W
  174.     CLS
  175.     PRINT STRING$(80,"=");
  176.     ON W GOTO START,PGMB,BYE
  177. BYE:
  178.     PRINT STRING$(80,"=");
  179.     PRINT
  180.     PRINT
  181.     PRINT
  182.     PRINT "*******************   B Y E   *********************"
  183.     PRINT
  184.     PRINT
  185.     PRINT
  186.     PRINT
  187.     PRINT STRING$(80,"=");
  188.     END
  189.