This commit is contained in:
schoener 2021-11-04 19:23:34 +01:00
parent 9e8fd02e19
commit c22e00c0df
38 changed files with 198 additions and 131 deletions

View File

@ -0,0 +1,29 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 1000
lim = 1
nr_points = (2 * lim) * scale + 1
x = np.linspace(-lim,lim,nr_points)
z = np.linspace(-lim,lim,nr_points)
def mu_it(x_pos):
it = nr_points//2 + x_pos
return it
Wires = [[0.45, 0.514],[0.475, 0.543],[0.5, 0.568]]
Wire_1 = Wires[2]
#I_current = 0.94
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = Wire_1[0],
wire_width = Wire_1[0], insulation_thickness=(Wire_1[1] - Wire_1[0]) / 2, is_round = True,
winding_scheme= 2)
R = HH_Coil.resistance(150)
print(2400/R)

View File

@ -0,0 +1,82 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 1000
lim = 1
nr_points = (2 * lim) * scale + 1
x = np.linspace(-lim,lim,nr_points)
z = np.linspace(-lim,lim,nr_points)
def mu_it(x_pos):
it = nr_points//2 + x_pos
return it
Wires = [[0.45, 0.514],[0.475, 0.543],[0.5, 0.568]]
Wire_1 = Wires[2]
#I_current = 0.94
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = Wire_1[0],
wire_width = Wire_1[0], insulation_thickness=(Wire_1[1] - Wire_1[0]) / 2, is_round = True,
winding_scheme= 2)
print(f"HH N = {HH_Coil.get_N()}")
I = 64 / HH_Coil.get_N() * 1.25
# set radius plus distance
HH_Coil.set_R_outer(50.5 - HH_Coil.get_tot_wire_width()*1e3)
HH_Coil.set_d_min(47.15)
# HH_Coil.B_quick_plot(I)
# HH_Coil.B_curv_quick_plot(I)
# HH_Coil.plot_raster()
HH_Coil.print_info()
D_max = 2 * (HH_Coil.get_R_inner()*1e3 - 1) * np.tan(np.radians(41.11))
print(D_max)
AHH_Coil = BC.BCoil(HH = -1, distance = 54, radius = 48, layers = HH_Coil.get_layers, windings=2 * HH_Coil.get_windings,
wire_height = Wire_1[0], wire_width=Wire_1[0], insulation_thickness=(Wire_1[1] - Wire_1[0]) / 2,
is_round = True, winding_scheme= 2)
AHH_Coil.set_R_inner(HH_Coil.get_R_inner() * 1e3)
AHH_Coil.set_d_max(D_max)
AHH_Coil.print_info()
print(f"AHH N = {AHH_Coil.get_N()}")
I_grad = I - 0.128 # 8 x 9#128 / AHH_Coil.get_N() * I
I_grad = I - 0.15 # 8 x 8
print(f"current @ 6G/cm: {I_grad} A")
AHH_Coil.B_grad_quick_plot(I_grad)
#Bz, Bx = AHH_Coil.B_field(I)
AHH_Coil.cooling(I_grad, 22.5)
#Bz, Bx = AHH_Coil.B_field(I_grad, x, z, raster = 7)
# Bz_grad = BC.BCoil.grad(Bz,z)
# Bx_grad = BC.BCoil.grad(Bx,x)
#AHH_Coil.B_quick_plot(I_grad)
#AHH_Coil.B_grad_quick_plot(I_grad)
AHH_Coil.plot_raster(raster_value= 11)
# zero = mu_it(0)
# print(f"Bz_grad({z[zero]}) = {Bz_grad[zero]} G/cm")
# mu = mu_it(1)
# mm = mu_it(1000)
# mid = mu_it(5000)
# outer = mu_it(15000)
# # Bz0 = Bz_grad[zero]
#
#
#
# print(f"Bz_grad({z[mu]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mu]}, relative = {(Bz0 - Bz_grad[mu])/Bz0}")
# print(f"Bz_grad({z[mm]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mm]}, relative = {(Bz0 - Bz_grad[mm])/Bz0}")
# print(f"Bz_grad({z[mid]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mid]}, relative = {(Bz0 - Bz_grad[mid])/Bz0}")
# print(f"Bz_grad({z[outer]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[outer]}, relative = {(Bz0 - Bz_grad[outer])/Bz0}")

View File

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -55,6 +55,8 @@ print(f"Diff B 1 mm: {Bz[16000] - Bz[15000]}, relative: {(Bz[16000] - Bz[15000])
print(f"Diff B 0.5 mm: {Bz[15500] - Bz[15000]}, relative: {(Bz[15500] - Bz[15000])/Bz[15000]}")
print(f"Diff B 15 mm: {Bz[30000] - Bz[15000]}, relative: {(Bz[30000] - Bz[15000])/Bz[15000]}")

View File

@ -46,6 +46,7 @@ Bz_curv = BC.BCoil.curv(Bz,z)
zero = mu_it(0)
print(z[zero])
print(f"Curvature = {Bz_curv[zero]}")
#Wire_1.B_quick_plot(I)
#Wire_1.B_curv_quick_plot(I,nr_points= 1000)

View File

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -1,103 +0,0 @@
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 23 17:40:37 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
#from src import B_field_calculation as bf
from src import coil_class as BC
from IPython import get_ipython
get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline')
#set up axis
x = np.linspace(-20, 20, 40001)
z = np.linspace(-20, 20, 40001)
#New coil
I_current = 10
d=69.4
HH_Coil = BC.BCoil(HH = -1, distance = d ,radius = 46.875 ,layers = 4, windings = 4 , wire_width= 1, wire_height= 2 ,layers_spacing = 0.25, windings_spacing= 0.25)
HH_Coil.print_info()
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10)
B_tot_z, B_tot_x = HH_Coil.B_field(I_current, x, z, raster = 10)
Bz = BC.BCoil.grad(Bz, z)
HH_Coil.cooling(I_current,28)
print(f"B_z(0) = {Bz[15000]} G")
#print(f"B_z_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2")
print(f"B_z(1 μm) = {Bz[15001]}")
print(f"B_z(1 mm) = {Bz[16000]}")
print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}")
print(f"Diff B 0.5 mm: {Bz[15500] - Bz[15000]}, relative: {(Bz[15500] - Bz[15000])/Bz[15000]}")
print(f"Diff B 1 mm: {Bz[25000] - Bz[15000]}, relative: {(Bz[25000] - Bz[15000])/Bz[15000]}")
print(f"Diff B 1 mm: {Bz[32000] - Bz[15000]}, relative: {(Bz[32000] - Bz[15000])/Bz[15000]}")
print(z[32000])
print(z[15000])
plt.figure(300)
"""
#Field plot
##########################
plt.subplot(2,1,1)
plt.plot(z,Bz,linestyle = "solid", label = r"$B_z along z-axis")
plt.plot(z,B_tot_z, linestyle = "dashed", label = "New B_tot along z-axis")
#plt.plot(x,B_tot_x, label = "B_tot along x-axis")
#plt.plot(z,B_z_comp,linestyle = "solid", label = r"$B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 A, 4 x 4")
#plt.plot(z,B_tot,linestyle = "solid", label = r"$B_{z,1} + B_{z,2}$")
#plt.xlim(-0.01,0.01)
plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]")
plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
plt.subplot(2,1,2)
plt.plot(z,Bz_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44 mm, R = 44 mm")
#plt.plot(z,B_z_comp_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 A")
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
#plt.savefig("output/first_compensation_idea.png")
plt.show()
"""
"""
AHH ############################################################################
###############################################################################
###############################################################################
"""

View File

@ -0,0 +1,44 @@
"""
Created on 3.11.21
@author: Joschka
"""
import numpy as np
from src import coil_class as BC
def main():
dens = 999.78 # kg/m^3
c_p = 4190 # J/kg*K
d_T = 3
flow = 0.3#/5 #m/s
#flow *=2
print(f"flow = {flow}m/s")
V_t = 4.8 * 3.2 * 1e-6 * flow
print(f"Volume rate = {V_t * 1e6} mL/s")
m = dens * V_t
Q = m * c_p * d_T
print(f"Q = {Q} J/s")
HH_Coil = BC.BCoil(HH=1, distance=51.694, radius=47.9263, layers=8, windings=8, wire_height=0.5,
wire_width=0.5, insulation_thickness=0.034, is_round=True,
winding_scheme=2)
for I in np.arange(1,7,0.001):
P = HH_Coil.power(I, 23)
if P > Q:
break
print(f"Power = {P} W @ {I} A")
B_max = HH_Coil.max_field(I)
print(f"max field = {B_max} G")
if __name__ == '__main__':
main()

View File

@ -61,7 +61,8 @@ class BCoil:
self.insulation_thickness = insulation_thickness * 1e-3
self.is_round = is_round
self.winding_scheme = winding_scheme
# Standard get/set functions
# Standard get/set functions
@property
def get_HH(self):
return self.HH
@ -178,8 +179,6 @@ class BCoil:
2 - np.sqrt(3)) * self.get_tot_wire_width() / 2 # width is reduced due to winding offset
return self.get_tot_wire_width() * self.layers
def winding_raster(self):
"""
generates raster of flowing currents
@ -394,6 +393,27 @@ class BCoil:
# print(f"time = {end - start} s")
return B_z, B_x
def max_field(self, I_current,raster = 7):
B_z_0 = 0
calc_raster = self.full_raster(raster)
if self.get_N() != len(calc_raster):
log.error("N is not equal length of raster")
rastering_value = len(calc_raster[0])
I_current /= rastering_value # divide current into smaller currents for mapping the whole wire
for wire in range(0, self.get_N()):
for ii in range(0, rastering_value):
# extract position information out of raster
z_pos = calc_raster[wire, ii, 0]
r_pos = calc_raster[wire, ii, 1]
B_z_0 += BCoil.B_z_loop(I_current, r_pos, z_pos, 0, 0) + BCoil.B_z_loop(self.HH * I_current,
r_pos, -z_pos, 0, 0)
return B_z_0
def B_tot_along_axis(self, I_current, x, z, raster=10):
"""
return B_tot_z, B_tot_x
@ -620,7 +640,6 @@ class BCoil:
plt.show()
def cooling(self, I_current, T):
"""
Print current density and power
@ -686,8 +705,12 @@ class BCoil:
def main():
Coil_1 = BCoil(HH = 1, distance = 54, radius = 48, layers = 7, windings = 8, wire_height = 0.6, wire_width = 0.5, insulation_thickness= 0.05, is_round = True, winding_scheme= 2)
Coil_1.plot_raster()
Coil_1 = BCoil(HH=1, distance=54, radius=48, layers=8, windings=8, wire_height=0.5, wire_width=0.5,
insulation_thickness=0.05, is_round=True, winding_scheme=2)
# Coil_1.plot_raster()
res_m = BCoil.resistivity_copper(20) * 1 / Coil_1.get_wire_area()
print(res_m)
# main()
if __name__ == "__main__":

View File

@ -6,31 +6,20 @@ Created on Fri Oct 1 10:42:13 2021
"""
import numpy as np
a = np.ones(50)
for i in range(0,len(a)):
a[i] *= i
def main():
wire_width = 0.568
r_in = 45.92 + wire_width/2
d_in = r_in * 2
r_2 = r_in + wire_width
r_3 = r_2 + wire_width
r = r_in + 4*wire_width
res = 2*r
print(a)
print(res)
print(a[:5])
print(a[5:])
print(a[:-5])
print(10e-3/13.7)
a = 7
if (a == (7 or 3)):
print("true")
print(40*1e-3*np.pi)
print(4/0.127)
print(30/0.3)
print(30/400)
print(4.3*4.8/(60*(0.475/2)**2 *np.pi))
print(np.sin(np.radians(90)))
if __name__ == '__main__':
main()