コード例 #1
0
ファイル: plotlayer.py プロジェクト: imrehg/physicscalc
# zl, ideal = zip(*data['ideal'])
# print zl, ideal
zl = data['ideal'][0]
ideal = data['ideal'][1]
d0 = data['d0']

# print data['setup']
# print newsetup['layer']
# print data.files

zeropos = 31
zz = np.append(np.linspace(-0.3, 0.01, zeropos), np.linspace(0, 1.1, 201))
curr = layer.bideal(0)/layer.fieldcalc(zz, newsetup, d=d0)[zeropos]
print 'Current = %.2f A' %(curr)

wirelen = layer.totalcoillength(newsetup, d=d0)
print 'Wire length = %.3f m ' %(wirelen)

resist = 0.334 * wirelen / 100.0
power = resist * curr*curr
print 'Minimum power = %.2f W' %(power)


pl.figure(figsize=(11.69, 8.27), dpi=100)
pl.plot(zl, layer.normalize(ideal, 1), 'ko', markersize=6, label='fitted field')
pl.plot(zz, layer.normalize(layer.fieldcalc(zz, newsetup, d=d0), zeropos), 'r-', linewidth=2.4, label='coil field')

x = layer.getLayerNumber(newsetup)
pl.plot(newsetup['looppos'], np.array(x[0])/10.0, 'g--', label='coil wind number / 10')
pl.xlabel('Position')
pl.ylabel('Field / Coil wind number')
コード例 #2
0
ファイル: summaries.py プロジェクト: imrehg/physicscalc
        ## Slower length
        d = wire[0]/2  # half wire diameter
        l1 = segments[1][0]
        l2 = segments[-2][1]-1
        slength = (looppos[l2]+d) - (looppos[l1]-d)
        sizes[j, i] = slength * 100  # turn into cm

        ## Current
        bideal = zs.bideal(atom, 0, eta, v0, vf, detu)
        bthis = lo.fieldcalc(0, setup)
        I0 = bideal / bthis
        currents[j, i] = I0

        ## Power
        totallen = lo.totalcoillength(sim['setup'], sim['R'], sim['wire'][0])
        resistance = sim['wire'][1] * totallen
        power = resistance * I0**2
        powers[j, i] = power

        ## Weight
        volume = totallen * ((sim['wire'][0]/2)**2 * np.pi)
        weight = volume * weightUnit
        weights[j, i] = weight

    ## Plot the Power vs. Weight curve
    pl.plot(weights[:, i], powers[:, i], deco[i], label='Series %d' %s, linewidth=2)
    pl.legend(loc='best')
    pl.xlabel('Slower weight [kg]', fontsize=15)
    pl.ylabel('Power [W]', fontsize=15)
pl.savefig("%s.png" %sumname)