Example #1
0
from matplotlib import pyplot as plt
import spiral

data = list(spiral.ellipticalspiral(10, 20, 1, 5, 80))
plt.plot([d[0] for d in data], [d[1] for d in data])
plt.show()
Example #2
0
zpitch = args.zpitch * args.scale
if args.pad_size is None:
    pad_size = trace_width
else:
    pad_size = args.pad_size * args.scale

if args.thickness is not None:
    trace_height = args.thickness * args.scale
else:
    # 1 oz/ft² copper is 1.5 mils thick = .03406 mm
    trace_height = args.weight * .03406

if args.shape == 'square':
    coil = spiral.squarespiral(side1, side2, pitch, args.turns)
else:
    coil = spiral.ellipticalspiral(side1, side2, pitch, args.turns,
            args.vertices_per_turn)
coil = list((x * args.mirror, y) for x,y in coil)

if args.fasthenry:
    angfreq = 2 * math.pi * args.frequency
    Z = coil_impedance(((x,y,ii*zpitch/4) for ii, (x,y) in enumerate(coil)),
            trace_width, trace_height, args.frequency)
    L = Z.imag / angfreq
    C = 1 / (angfreq * Z.imag)
    Q = Z.imag / Z.real
    print('Analysis of {}m x {}m {}-turn {}m pitch {}m trace inductor at {}Hz\n'.format(
        si_prefix_format(side1*2e-3), si_prefix_format(side2*2e-3), args.turns,
        si_prefix_format(pitch*1e-3), si_prefix_format(trace_width*1e-3),
        si_prefix_format(args.frequency)))
    print('          Inductance: {}H'.format(si_prefix_format(L)))
    print('Resonant capacitance: {}F'.format(si_prefix_format(C)))
Example #3
0
zpitch = args.zpitch * args.scale
if args.pad_size is None:
    pad_size = trace_width
else:
    pad_size = args.pad_size * args.scale

if args.thickness is not None:
    trace_height = args.thickness * args.scale
else:
    # 1 oz/ft² copper is 1.5 mils thick = .03406 mm
    trace_height = args.weight * .03406

if args.shape == 'square':
    coil = spiral.squarespiral(side1, side2, pitch, args.turns)
else:
    coil = spiral.ellipticalspiral(side1, side2, pitch, args.turns,
                                   args.vertices_per_turn)
coil = list((x * args.mirror, y) for x, y in coil)

if args.fasthenry:
    angfreq = 2 * math.pi * args.frequency
    Z = coil_impedance(
        ((x, y, ii * zpitch / 4) for ii, (x, y) in enumerate(coil)),
        trace_width, trace_height, args.frequency)
    L = Z.imag / angfreq
    C = 1 / (angfreq * Z.imag)
    Q = Z.imag / Z.real
    print(
        'Analysis of {}m x {}m {}-turn {}m pitch {}m trace inductor at {}Hz\n'.
        format(si_prefix_format(side1 * 2e-3), si_prefix_format(side2 * 2e-3),
               args.turns, si_prefix_format(pitch * 1e-3),
               si_prefix_format(trace_width * 1e-3),