#!/usr/bin/python -u ###----------------------------------------------------------------### ## ## Author : David Billsbrough ## Created : Monday, January 14, 2008 at 01:10:27 AM (EST) ## License : GNU General Public License - version 2 ## Version : $Revision: 0.2 $ ## Warranty : None ## ###----------------------------------------------------------------### # $Id: moxon.py,v 0.2 2008/01/14 07:46:40 kc4zvw Exp kc4zvw $ import math, os, sys """ Calculate_Moxon_Rectangle """ AA = -0.0008571428571 AB = -0.009571428571 AC = 0.3398571429 BA = -0.002142857143 BB = -0.02035714286 BC = 0.008285714286 CA = 0.001809523381 CB = 0.01780952381 CC = 0.05164285714 DA = 0.001 DB = 0.07178571429 wire_units = 0 def displayBanner(): os.system("clear") # Clear Screen print print 'Program to calculate the dimensions of a Moxon Rectangle.' print print 'All equations correlated to NEC antenna modeling software for wire' print 'diameters from 1E-5 to 1E-2 wavelengths.' print print 'Designed by L. B. Cebik, W4RNL' print 'Ported to Python by David Billsbrough, KC4ZVW' print """ Main begins here """ while (1): displayBanner() sys.stdout.write('Enter desired frequency in MHz : ') freq = float(sys.stdin.readline()) print 'Select units for wire diameter in 1. Inches, 2. Millimeters, 3. Wavelengths' while ((wire_units < 1) or (wire_units > 3)): sys.stdout.write("Choose 1, 2 or 3 : ") wire_units = int(sys.stdin.readline()) print sys.stdout.write("Enter wire diameter in your selected units : ") wd = float(sys.stdin.readline()) if (wire_units == 1): wli = 11802.71 / freq dw = wd / wli elif (wire_units == 2): wli = 299792.5 / freq dw = wd / wli elif (wire_units == 3): dw = wd else: print "Invalid option." sys.exit(1) print "Wire diameter in wavelengths: %f" % dw d1 = 0.4342945 * math.log10(dw) if (d1 < -6): print 'Wire diameter less than 0.000001 (1E-6) wavelengths: Results uncertain.' if (d1 > -2): print 'Wire diameter greater than 0.01 (1E-2) wavelengths: Results uncertain.' a = (AA * (d1 ** 2)) + (AB * d1) + AC b = (BA * (d1 ** 2)) + (BB * d1) + BC c = (CA * (d1 ** 2)) + (CB * d1) + CC d = (DA * d1) + DB e = (b + c) + d print print 'Moxon Dimensions in Wavelengths:' print print " A = %f" % a print " B = %f" % b print " C = %f" % c print " D = %f" % d print " E = %f" % e wf = 983.5592 / freq wfi = wf * 12 print print "Wavelength: = %7.4f feet or %7.4f inches\n" % (wf, wfi) print print 'Dimensions in feet and inches' print print " A = %7.4g feet or %7.4g inches" % (a * wf, a * wfi) print " B = %7.4g feet or %7.4g inches" % (b * wf, b * wfi) print " C = %7.4g feet or %7.4g inches" % (c * wf, c * wfi) print " D = %7.4g feet or %7.4g inches" % (d * wf, d * wfi) print " E = %7.4g feet or %7.4g inches" % (e * wf, e * wfi) print print 'Another Value = 1, Stop = 2: ' p = int(sys.stdin.readline()) if (p != 1): break print sys.exit(0) # End of script