-
Notifications
You must be signed in to change notification settings - Fork 0
/
trap.py
40 lines (24 loc) · 1.04 KB
/
trap.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
PROGRAM: trap.py
Calculate trap resonate frequency based on coil inductance based on coil dimensions and capacitor value. The inductance formula assumes a relative permiability
of air as a value of 1.
"""
from math import pi,sqrt
diameter=float(input("Enter coil diameter in inches:"))
N=float(input("Enter number of turns in coil:"))
L=float(input("Enter length of coil in inches:"))
capValue=input("Enter capacitor value in pF:")
if capValue == "": #default to 100 pF
capValue=100
pF=float(capValue) #convert capValue from string to float
inductance=(diameter**2) * (N**2) / ((18*diameter) + (40 * L))
FARAD=pF*10**-12 #convert pF to Farads for LC formula
HENRY=inductance/10**6 #convert uH to Henries for LC formula
freq=1/(2*pi*sqrt(HENRY*FARAD))
print (FARAD)
print (HENRY)
print(freq)
mhz=freq*10**-6 #convert hertz to megahertz
print("\n\n")
print ('COIL INDUCTANCE = %0.3f uH'%inductance)
print ('FREQUENCY = %0.3f MHZ'%mhz)