home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / tech / design4 / qcorr.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1987-02-20  |  3.0 KB  |  87 lines

  1. 1  '            Q CORRECTION FACTOR FOR COAXIAL CAVITIES
  2. 2  '
  3. 3  '   Written for the Amiga computer by Robert F. Arnesen, P.E.  3/23/86
  4. 4  '
  5. 5  '   Re-written for IBM type machines 20 February 1987.
  6. 6  '
  7. 7  '  This program is for plotting the correction factor to be used in order
  8. 8  'to determine the unloaded Q of a coaxial cavity resonator of any ratio of
  9. 9  'cavity to post diameter (D/d) using the ideal ratio of 3.6 to 1 as the
  10. 10  'criterion.
  11. 11  '
  12. 12  SCREEN 2: CLS
  13. 13  A = 40                              'Y axis offset
  14. 14  B = 100                             'Y axis multiplier
  15. 15  C = 2.30258                        'Ln to base 10 conversion
  16. 16  D = 171                             'X axis location
  17. 17  E = A+530                           'End of X axis
  18. 18  F = 160                             'No. of horiz. lines in graph
  19. 19  G = 3.6                             'Optimum cavity/post
  20. 20  S = 385
  21. 21  T = 22
  22. 22  U = 2                               'Number of log cycles
  23. 23  '
  24. 24  FOR K=D TO 5 STEP -8
  25. 25    LINE (A,K)-(E,K)                  'Draw the 20 horizontals
  26. 26  NEXT K
  27. 27  '
  28. 28  FOR K=1 TO 10
  29. 29    GOSUB 78                          'Draw the first cycle
  30. 30  NEXT K
  31. 31  '
  32. 32  FOR K=20 TO 100 STEP 10
  33. 33    GOSUB 78                          'Draw the second cycle
  34. 34  NEXT K
  35. 35  '
  36. 36  LOCATE 22,75: PRINT "D";            'Print X axis title
  37. 37  LINE (595,181)-(614,170)
  38. 38  LOCATE 23,77: PRINT "d";
  39. 39  '
  40. 40  FOR K=20 TO 0 STEP -2
  41. 41    LOCATE(22-K),2
  42. 42    PRINT USING "#.#"; K/20           'Print Y axis numbers
  43. 43  NEXT K
  44. 44  '
  45. 45  LOCATE 1,3: PRINT "K"               'Print Y axis title
  46. 46  '
  47. 47              'Print the title & X axis numbers for the graph
  48. 48  LOCATE 1,10
  49. 49  PRINT "UNLOADED Q CORRECTION FACTOR - FROM D/d = 3.6 TO ANY RATIO"
  50. 50  LOCATE 23,6
  51. 51  PRINT "1         2    3   4        7   10        20    30  40 50   70   100";
  52. 52  '
  53. 53              'Draw the coaxial cavity
  54. 54  LINE (S-45,T-2)-(S+103,T+28),2,BF       'Blank the cavity area
  55. 55  LINE (S,T)-(S+100,T+27),1,B             'Go ahead and draw it
  56. 56  LINE (S+32,T+7)-(S+100,T+19),1,BF       'Draw the center post
  57. 57  LINE (S-20,T)-(S-10,T)                  'Draw the dimensioning lines
  58. 58  LINE (S-20,T+27)-(S-10,T+27)
  59. 59  LINE (S+15,T+7)-(S+25,T+7)
  60. 60  LINE (S+15,T+19)-(S+25,T+19)
  61. 61  LOCATE 5,47: PRINT "D"              'The cavity diameter
  62. 62  LOCATE 5,51: PRINT "d"              'The post diameter
  63. 63  '
  64. 64              'Line plotting routine
  65. 65  PSET (A,D)                          'Set up line origen
  66. 66  FOR K=1 TO 10 STEP 0.2               'Plot the first section
  67. 67    GOSUB 82
  68. 68  NEXT K
  69. 69  '
  70. 70  FOR K=10 TO 100 STEP 2              'Keep going
  71. 71    GOSUB 82
  72. 72  NEXT K
  73. 73  '
  74. 74  LOCATE 19,1                         'Put BASIC's OK here
  75. 75  '
  76. 76  END
  77. 77  '
  78. 78  X = A+(B*C*LOG(K))/U                'The U makes it 2 cycles
  79. 79  LINE (X,D)-(X,11)                   'This draws the vertical lines
  80. 80  RETURN
  81. 81  '
  82. 82  X = A+(B*C*LOG(K))/U                'Plot insertion loss line
  83. 83  W = ((1+G)/LOG(G))*(LOG(K))/(1+K)
  84. 84  Y = D-INT(F*W)
  85. 85  LINE -(X,Y)                         'Draw the line segment
  86. 86  RETURN
  87.