76 lines
1.8 KiB
Python
76 lines
1.8 KiB
Python
import numpy as np
|
|
import matplotlib.pyplot as plt
|
|
import src.coil_class as BC
|
|
|
|
|
|
I_current = 1.25
|
|
|
|
# scale = 1000 --> μm
|
|
scale = 1000
|
|
lim = 5
|
|
nr_points = (2 * lim) * scale + 1
|
|
x = np.linspace(-lim,lim,nr_points)
|
|
z = np.linspace(-lim,lim,nr_points)
|
|
print(x)
|
|
|
|
def mu_it(x_pos):
|
|
it = nr_points//2 + x_pos
|
|
return it
|
|
|
|
print(x[mu_it(-60)])
|
|
|
|
#standard
|
|
C1 = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5, wire_width = 0.5, insulation_thickness= 0.06, is_round = True, winding_scheme= True)
|
|
C1.set_R_outer(49.8)
|
|
C1.set_d_min(49.8)
|
|
C1.print_info()
|
|
|
|
Bz, Bx = C1.B_tot_along_axis(I_current, x, z,raster = 2)
|
|
|
|
# plt.figure(5)
|
|
# plt.plot(z,Bz)
|
|
# plt.plot(x,Bx, label = "B_tot along x-axis")
|
|
# plt.show()
|
|
#plt.close(5)
|
|
|
|
|
|
#coil is ~ 500 μm thicker
|
|
shift_radius = 1#0.125
|
|
C_shift = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5, wire_width = 0.5, insulation_thickness= 0.06, is_round = True, winding_scheme= True)
|
|
C_shift.set_R_outer(49.8 + shift_radius)
|
|
C_shift.set_d_min(49.8)
|
|
|
|
#shift_radius = 0.125
|
|
|
|
Bz2, By = C_shift.B_tot_along_axis(I_current+0.00082, x, z,raster = 2)
|
|
|
|
shift_int = int(shift_radius * scale - 1)
|
|
print(shift_int)
|
|
By_shift = By[shift_int:]
|
|
y_shift = x[:-shift_int]
|
|
print(By_shift)
|
|
print(y_shift)
|
|
B_sum = (By_shift + Bx[:-shift_int])/2
|
|
# shift By shift with shift radius
|
|
|
|
plt.figure(6)
|
|
#plt.plot(z,Bz)
|
|
plt.plot(x,Bx, label = "B_tot along x-axis")
|
|
plt.plot(y_shift,By_shift, label = "Shiftet tot B")
|
|
plt.plot(y_shift,B_sum, label = "B_sum")
|
|
plt.legend()
|
|
plt.show()
|
|
#plt.close(5)
|
|
|
|
it = mu_it(int(-shift_radius * 1e3 // 2))
|
|
#it = μm_it(-60)
|
|
print(it)
|
|
zero = mu_it(0)
|
|
print(y_shift[it])
|
|
print(y_shift[zero])
|
|
|
|
tot_diff = B_sum[it]-B_sum[zero]
|
|
|
|
print(f"diff {y_shift[it]} μm --> 0: {tot_diff} G, relative = {tot_diff/B_sum[it]}")
|
|
|