I'm making progress with the rod inductance calculator. Since there seems to be no good calculator online, I intend it to be complete, precise and open source.
As a first step, I have refined the air coil inductance calculator to include Nagaoka's factor with 4ppm precision, Rosa's corrections to the tens of ppms, internal inductance, and substituting coil length by number of turns and winding pitch. I've followed the magnificent notes by
David W. Knight, taking his most precise formulas (to the exception of those that depend on elliptic functions-- I have discovered that the SciPy version 0.13.3 in my python does not compute them well, after some hours of frustration, so I have used the best polynomial formulas provided, and tested against Maple and known data to assure correctness).
The code, as it stands now, is:
from math import log, log10, sqrt, exp
# Ferrite rod inductance calculator.
#
# Calculations taken from:
#
# [P] Payne, Alan. "The Inductance of Ferrite Rod Antennas".
# http://g3rbj.co.uk
#
# [K] David W. Knight. "Solenoid inductance calculation".
# http://www.g3ynh.info
pi = 3.14159265358979323
dpi = 2*pi
pi2 = pi ** 2
pim1 = 1 / pi
pid2 = pi / 2
sqr2 = sqrt(2)
mu_ir = 0.999995044 # Copper relative permeability.
mu_i = 4 * pi * 1e-7 * mu_ir # Copper permeability.
rho = 1.7241e-8 # Copper resistivity (annealed)
#######
# COIL DIMENSION RELATED:
#
# Minimum pitch angle, in case we need it.
# [K] formula 5.5, independent of units.
def psi_min(dc, dw):
return arcsin(dw / (pi * dc))
# Secant of pitch angle, [K] 5.2.
def sec_psi(lc, dc, N):
return sqrt(1 + (lc / (pi * dc * N))**2)
# Minimum wire pitch.
# [K] formula 5.4, dimensional but unit independent.
def p_min(dc, dw):
return dw / sqrt(1.0 - (dw / (pi*dc))**2)
# Current-sheet diameter correction, for thick wires.
# [K] formula 3.1a. Independent from units.
def D0(dc, dw):
return dc * (1.0 - (1.0 * dw / dc))
# Length of wire.
# Dimensional, but independent of units.
def lw(p, N):
return p*N
###
# NAGAOKA CORRECTIONS:
#
# Nagaoka's factor, Lundin's formula, [K] Sec. 8a.
# This formula does not change with length units.
# Tested against exact (Lorenz) with Maple.
def Kn(lc, dc):
if (lc > dc):
x = 1.0 * dc / lc
x2 = x * x
return (1 + (0.383901 + 0.017108*x2) * x2) / (1 + 0.258952*x2) - (4*x)/(3*pi)
else:
x = 1.0 * lc / dc
x2 = x * x
t1 = (1 + (0.383901 + 0.017108*x2) * x2) / (1 + 0.258952*x2)
t2 = (0.093842 + (0.002029 - 0.000801*x2) *x2 ) *x2
return (2 * x / pi ) * ( -t1 * ( log(0.25*x) + 0.5 ) + t2 )
###
# INTERNAL INDUCTANCE:
#
# THIS CORRECTION IS NOT ENHANCED BY THE MAGNETIC CORE!
# Skin depth. Answer in mm. This formula is dimensional.
def d_i(f):
return 1e3 * sqrt(rho / (pi * f * mu_i))
# Internal inductance factor. [K], formula 6.4.
ex0 = 1 / 3.74
def phi(dw, f):
di = d_i(f)
z = (0.27445 * dw) / (sqr2 * di)
y = 0.02369 / ( 1 + 0.2824 * (z**1.4754 - z**(-2.793))**2 )**0.8955
t = ( 1 - exp( -(dw/(4*di))**3.74) )**ex0
return 4 * di * t / (dw * (1-y))
# Internal inductance in Henries. [K], formula 6.5
def Li(lc, dc, dw, N, f = 0):
return mu_i * (1e-3 * dc) * N * phi(dw, f) * 0.125 * sec_psi(lc, dc, N)
###
# ROSA'S CORRECTIONS:
#
# Rosa's self inductance correction. [K], formula 10.9.
#
k0 = 1 / (log(8*pim1) - 0.5)
k1 = 3.437
k2 = 24 / (3*pi2-16)
w1 = -0.47
w2 = 0.755
def Pnom(x):
return k0 + (k1 + k2 * x)*x + w1 / (w2 + (1 / x))**1.44
def Ks(lc, dc, N, dw, f = 0):
x = lc / (N * dc) # p / D
y = dw / dc
z = log(0.125 * y)
t = log(1 + pid2 / x) + 1 / Pnom(x) + z + 2
t -= y * y * (0.333333333333333 - z) / 8
t -= mu_ir * phi(dw, f) * 0.25 * sqrt(1 + (lc * pim1 / (N * dc))**2)
return t
# Rosa's mutual inductance correction. [K], formula 10.18.
#
c0 = log(dpi) - 1.5
c1 = -0.33084236
c2 = -1.0 / 120
c3 = 1.0 / 504
c4 = -0.0011925
c9 = -(c0 + c1 + c2 + c3 + c4)
def Km(N):
x = 1.0 / N
x2 = x*x
return c0 + ( -log(N)/6 + c1 + ( c2 + (c3 + (c4 + c9*x2) * x2) * x2) * x2) * x
##
# INDUCTANCE OF AIR CORE COIL:
#
# Inductance of air core coil, formula A1.1.
# All lengths in millimeters.
# NOTE: Internal inductance __NOT__ added.
def L0(lc, dc, N, dw = 0, f = 0, thin = True, rosa = True):
if (thin): # Thick wire corrention?
my_dc = dc
else:
my_dc = D0(dc, dw)
if (rosa):
rosa = ( Km(N) + Ks(lc, dc, N, dw, f) ) * lc / (pid2 * dc * N)
else:
rosa = 0
return pi2 * 1e-10 * N**2 * (my_dc ** 2) / lc * ( Kn(lc, my_dc) - rosa )
#
# The following formulae are independent of length unit.
#
# Relative flux to maximum, due to finite permeability, formula 8.1:
def rflux(lf, lc, df, uf):
return 1.0 / (1.0 + ((1.0*(lf - lc)/df)**1.4) / (5.0*uf) )
# Relative reluctance, outside, formulae 7.5, 7.6 (corrected in 8.2)
def k(lf, lc, df, dc, rel_flux):
canf_d_e0 = 0.5 * pi* (lf-lc) / ( log(2.0*(lf+df)/df) - 1.0)
return (rel_flux * canf_d_e0 + 2.0*df)/(2.0*dc)
# Formula 4.1
def x(lf, lc, df, dc):
return 4.46 * lc / dc / (1 + 1.17*dc/lc)
# Inductance ratio, formula 5.1.1
def Lr(lf, lc, df, dc, uf):
my_x = x(lf, lc, df, dc)
rel_flux = rflux(lf, lc, df, uf)
my_k = k(lf, lc, df, dc, rel_flux)
return (1.0 + my_x) / ( 1.0 / my_k + my_x / uf)
# Apparent permeability correction, formula 5.2.1
def uapp(df, dc, uf):
return ( (uf - 1.0) * ((1.0 * df) / dc)**4 ) + 1
#
# Adding it up:
#
def coil():
dc = input("Coil diameter (mm) : ")
dw = input("Wire diameter (mm) : ")
N = input("Number of turns : ")
p = input("Winding pitch (mm)(zero for minimum) : ")
if (p == 0):
p = p_min(dc ,dw)
print ("-> Okay, pitch = %f mm" % p)
lc = N * p
lf = input("Ferrite length (mm) : ")
df = input("Ferrite diameter (mm) : ")
uf = input("Ferrite permeability : ")
f = input("Frequency : ")
my_L0 = L0(lc, dc, N, dw, f, thin=True, rosa=True) * 1e6
my_uf = uapp(df, dc, uf) # Coil-rod air gap correction.
my_Lr = Lr(lf, lc, df, dc, my_uf)
my_Li = Li(lc, dc, dw, N, f) * 1e6
print "Coil length, in mm : ", lc
print "Winding pitch, in mm : ", p
print "Internal inductance, in uH : ", my_Li
print "Relative uf due to gap : ", my_uf
print "Air core inductance, L0, in uH: ", my_L0 + my_Li
print "Inductance gain with rod L/L0 : ", my_Lr
print "Inductance of ferrite rod, uH : ", my_L0 * my_Lr + my_Li
and an example of use:
>>> coil()
Coil diameter (mm) : 9.3
Wire diameter (mm) : 0.3
Number of turns : 80
Winding pitch (mm)(zero for minimum) : 0
-> Okay, pitch = 0.300016 mm
Ferrite length (mm) : 50
Ferrite diameter (mm) : 9
Ferrite permeability : 100
Frequency : 1000000
Coil length, in mm : 24.0012652969
Winding pitch, in mm : 0.300015816212
Internal inductance, in uH : 0.0991453072228
Relative uf due to gap : 87.8307271843
Air core inductance, L0, in uH: 19.107760332
Inductance gain with rod L/L0 : 17.2919651051
Inductance of ferrite rod, uH : 328.795453012
Since there are so much parameters, and more to come, a GUI is inevitable, to include graphs (vs. frequency, permeability, and core position at least). I'll try to stick to matplotlib and gtk, which can be downloaded in a bundle with
Portable Python and run at once.
I'll try to include, besides a direct inductance calculator:
-> Number of turns to achieve some inductance, given pitch, wire, coil radius and rod dimensions (permeability variable).
-> Permeability calculator, from inductance and dimensions for wire, coil and rod.
-> Off-center inductance calculator.
That's a lot of work, on top of my regular work and some heavy transistor testing I'm involved with, but I'll try to come trough.