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

  1. 1  '  Coupling Loop Location & Bandwidth Characteristics in Tuneable
  2. 2  '                     Coaxial Cavities
  3. 3  '
  4. 4  '  Written for the Amiga computer by Robert F. Arnesen, P.E.  09/01/86
  5. 5  '
  6. 6  '  Re-written for IBM type machines 20 February 1987.
  7. 7  '
  8. 8  '   This program asks for all necessary cavity parameters then calculates 
  9. 9  'and prints all of the bandwidths, and phase angles at the minimum, 
  10. 10  'center, and maximum frequencies, in columnar form.  This will take a 
  11. 11  'little time because of their complexity, how much depends on the computer   
  12. 12  'being used.  It will then print out the loop radius, it's area, and the 
  13. 13  'distance between the loop center and the shorting plane.
  14. 14  '
  15. 15  '
  16. 16  INPUT "What is the minimum frequency of interest (in gHz) "; F1
  17. 17  INPUT "What is the maximum frequency of interest (in gHz) "; F3
  18. 18  INPUT "What is the desired loaded Q value "; Q
  19. 19  INPUT "What is the proposed cavity diameter in millimeters "; S
  20. 20  INPUT "What is the impedance of the connections to the cavity in ohms "; Z1
  21. 21  INPUT "What is the characteristic impedance of the cavity in ohms"; Z2
  22. 22  INPUT "Is unit single or double loaded ?  Answer with S or D "; N$
  23. 23  IF N$ = "D" OR N$ = "d" THEN N = 0.25 ELSE N = 0.5
  24. 24  '
  25. 25  SCREEN 2: CLS                       'Clear the screen
  26. 26  B = 57.3                            'Radian conversion factor
  27. 27  PI = 3.14159
  28. 28  U = 2*PI
  29. 29  R = F3/F1
  30. 30  J = 0                               'Variable
  31. 31  '
  32. 32  PRINT "Please hold on a bit while I think about it."
  33. 33  '
  34. 34  '      Calculate the degree value at the highest frequency
  35. 35  FOR K=R TO 1 STEP -0.1                
  36. 36   FOR A=45 TO 90 STEP 0.1                 
  37. 37     IF COS(A/(B*K)) >= SQR(K^3)*COS(A/B) THEN 41
  38. 38   NEXT A
  39. 39  NEXT K
  40. 40  '
  41. 41   C = A/R                           'Degree value at lowest frequency 
  42. 42   E = (R-1)/2                       'Center frequency factor   
  43. 43   F = (A-C)/2                       'Frequency range
  44. 44   G = 1/COS(C/B)^2
  45. 45   H= N*Z1*Z2                        'For convenience
  46. 46   M = 1+E                           'Mult. factor for center frequency
  47. 47   A2 = M*C                          'Angle at center frequency
  48. 48   F2 = M*F1                         'True center frequency
  49. 49  '
  50. 50  '      Calculate loop A/R ratio at the Center Frequency
  51. 51  X = SQR(H/Q)/(F2*COS(A2/B))
  52. 52  V = X^2
  53. 53  '
  54. 54  CLS
  55. 55  '
  56. 56  '      Print the header
  57. 57  PRINT " F gHz       Bw in mHz    Theta Degrees "          
  58. 58  PRINT "-------     -----------  ---------------" 
  59. 59  '
  60. 60  '      Print the frequencies, the bandwidths, and the phase angles     
  61. 61  J = C                               'Reset the variable
  62. 62  FOR K=1 TO R+0.01 STEP E
  63. 63   L=K^3*(COS(J/B)^2)
  64. 64   PRINT USING "###.##        ";K*F1,(V*(K*F1)^3)*(COS((C*K)/B)^2)*1000/H,K*C
  65. 65   J = J+F
  66. 66  NEXT K  
  67. 67  '
  68. 68  '              Calculate the loop radius
  69. 69  Y = SQR(X/(2*U)^2 + (X*S)/U) - X/U
  70. 70  ' 
  71. 71  '              Calculate the loop area
  72. 72  Z = PI* Y^2
  73. 73  '
  74. 74  '              Calculate the loop distance from shorting plane
  75. 75  T = (0.8333*A2)/F2
  76. 76  '
  77. 77  '              Convert to single decimal place & print them out
  78. 78  Y = INT(Y*10)/10: Z = INT(Z*10)/10: T = INT(T*10)/10
  79. 79  PRINT
  80. 80  '
  81. 81  PRINT "Loop radius should be "; Y; " mm."
  82. 82  PRINT "Loop area should be "; Z; " sq. mm."
  83. 83  PRINT "Loop center should be "; T; "mm. from the shorting plane."
  84. 84  ' 
  85. 85  END            
  86.