FINAL Wire and winding decision
This commit is contained in:
parent
8595507a07
commit
e64fb4adec
@ -12,8 +12,8 @@ import numpy as np
|
|||||||
|
|
||||||
from src import coil_class as BC
|
from src import coil_class as BC
|
||||||
|
|
||||||
from IPython import get_ipython
|
#from IPython import get_ipython
|
||||||
get_ipython().run_line_magic('matplotlib', 'qt')
|
#get_ipython().run_line_magic('matplotlib', 'qt')
|
||||||
#get_ipython().run_line_magic('matplotlib', 'inline')
|
#get_ipython().run_line_magic('matplotlib', 'inline')
|
||||||
|
|
||||||
#set up axis
|
#set up axis
|
||||||
@ -22,10 +22,14 @@ z = np.linspace(-15, 15, 30001)
|
|||||||
|
|
||||||
|
|
||||||
#New coil
|
#New coil
|
||||||
I_current = 10
|
Wire_1 = [0.5, 0.568]
|
||||||
HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 2, wire_height = 2, wire_width = 1, windings_spacing=0.25, layers_spacing = 0.25)
|
I_current = 0.94
|
||||||
HH_Coil.set_R_inner(44.5)
|
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 10, windings = 9, 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)
|
||||||
HH_Coil.set_d_min(48.8)
|
|
||||||
|
#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)
|
||||||
print(f"height = {HH_Coil.get_coil_height()}")
|
print(f"height = {HH_Coil.get_coil_height()}")
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
|
|
||||||
|
@ -23,21 +23,25 @@ def mu_it(x_pos):
|
|||||||
return it
|
return it
|
||||||
|
|
||||||
|
|
||||||
wire_radius = 0.475
|
Wire_1 = [0.45, 0.6514]
|
||||||
|
for ll in range(7,11):
|
||||||
|
for ww in range(7,11)
|
||||||
|
Coil_1 = 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(Coil_1.get_tot_wire_width())
|
||||||
|
Coil_1.set_R_outer(50.5-Coil_1.get_tot_wire_width())
|
||||||
|
Coil_1.set_d_min(47.15)
|
||||||
|
Coil_1.print_info()
|
||||||
|
|
||||||
Wire_1 = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = wire_radius, wire_width = wire_radius, insulation_thickness= 0.068, is_round = True, winding_scheme= 2)
|
|
||||||
Wire_1.set_R_outer(49.8)
|
|
||||||
Wire_1.set_d_min(49.8)
|
|
||||||
Wire_1.print_info()
|
|
||||||
print(Wire_1.get_coil_width() * 1e3 * Wire_1.get_coil_height() * 1e3)
|
|
||||||
print(f"H = {Wire_1.get_coil_height() * 1e3}, W = {Wire_1.get_coil_width()*1e3}")
|
|
||||||
|
|
||||||
I = 64/Wire_1.get_N() *1.25
|
print(Coil_1.get_coil_width() * 1e3 * Coil_1.get_coil_height() * 1e3)
|
||||||
|
print(f"H = {Coil_1.get_coil_height() * 1e3}, W = {Coil_1.get_coil_width() * 1e3}")
|
||||||
|
|
||||||
|
I = 64 / Coil_1.get_N() * 1.25
|
||||||
print(f"I = {I} A")
|
print(f"I = {I} A")
|
||||||
Wire_1.cooling(I,22.5)
|
Coil_1.cooling(I, 22.5)
|
||||||
|
|
||||||
Wire_1.plot_raster(30)
|
Coil_1.plot_raster(30)
|
||||||
Bz, Bx = Wire_1.B_field(I,x,z, raster = 10)
|
Bz, Bx = Coil_1.B_field(I, x, z, raster = 1)
|
||||||
Bz_curv = BC.BCoil.curv(Bz,z)
|
Bz_curv = BC.BCoil.curv(Bz,z)
|
||||||
zero = mu_it(0)
|
zero = mu_it(0)
|
||||||
print(z[zero])
|
print(z[zero])
|
||||||
|
65
Coil_geometry/15_new_HH_coil_iterative_winding_decision.py
Normal file
65
Coil_geometry/15_new_HH_coil_iterative_winding_decision.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Created on Tue Sep 7 13:18:18 2021
|
||||||
|
|
||||||
|
@author: Joschka
|
||||||
|
"""
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
#Wire_1 = [0.45, 0.514]
|
||||||
|
#Wire_1 = [0.475, 0.543]
|
||||||
|
#Wire_1 = [0.5, 0.568]
|
||||||
|
|
||||||
|
Wires = [[0.45, 0.514],[0.475, 0.543],[0.5, 0.568]]
|
||||||
|
|
||||||
|
for i in range(0,2):
|
||||||
|
Wire_1 = Wires[i]
|
||||||
|
print(f"Wire core = {Wire_1[0]} mm:")
|
||||||
|
print(" ")
|
||||||
|
for ll in [8,10]:
|
||||||
|
for ww in [8,9]:
|
||||||
|
print(f"layers = {ll}, windings = {ww}")
|
||||||
|
Coil_1 = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = ll, windings = ww, 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)
|
||||||
|
|
||||||
|
#set radius plus distance
|
||||||
|
Coil_1.set_R_outer(50.5-Coil_1.get_tot_wire_width()*1e3)
|
||||||
|
|
||||||
|
Coil_1.set_d_min(47.15)
|
||||||
|
#Coil_1.print_info()
|
||||||
|
|
||||||
|
|
||||||
|
print(f" Coil crossection area = {Coil_1.get_coil_width() * 1e3 * Coil_1.get_coil_height() * 1e3} mm2")
|
||||||
|
print(f" H = {Coil_1.get_coil_height() * 1e3}, W = {Coil_1.get_coil_width() * 1e3}")
|
||||||
|
|
||||||
|
I = 64 / Coil_1.get_N() * 1.25
|
||||||
|
#I = 1
|
||||||
|
print(f" Current needed for 13.8 G: I = {I} A")
|
||||||
|
Coil_1.cooling(I, 22.5)
|
||||||
|
|
||||||
|
Bz, Bx = Coil_1.B_field(I, x, z, raster = 7)
|
||||||
|
Bz_curv = BC.BCoil.curv(Bz,z)
|
||||||
|
zero = mu_it(0)
|
||||||
|
|
||||||
|
print(f" Curvature = {Bz_curv[zero]:.4f} G/mm^2, B(0) = {Bz[zero]:.4f}")
|
||||||
|
print(f"ratio Power/Curvature: {Coil_1.power(I,22.5) * Bz_curv[zero]}")
|
||||||
|
print(" ")
|
||||||
|
|
||||||
|
|
||||||
|
|
48
Coil_geometry_AHH/08_FINAL_AHH.py
Normal file
48
Coil_geometry_AHH/08_FINAL_AHH.py
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
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[0]
|
||||||
|
|
||||||
|
#I_current = 0.94
|
||||||
|
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 9, 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)
|
||||||
|
|
||||||
|
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.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()
|
||||||
|
|
||||||
|
#AHH_Coil.B_grad_quick_plot(I)
|
||||||
|
#Bz, Bx = AHH_Coil.B_field(I)
|
||||||
|
AHH_Coil.cooling(I, 22.5)
|
19
Cooling/04_Power estimation.py
Normal file
19
Cooling/04_Power estimation.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib
|
||||||
|
#matplotlib.use('Qt5Agg')
|
||||||
|
from src import coil_class as BC
|
||||||
|
|
||||||
|
|
||||||
|
Wire_1 = [0.5, 0.568]
|
||||||
|
I_current = 1.33
|
||||||
|
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 10, 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)
|
||||||
|
|
||||||
|
#set radius plus distance
|
||||||
|
HH_Coil.set_R_outer(50.5 - HH_Coil.get_tot_wire_width())
|
||||||
|
HH_Coil.set_d_min(47.15)
|
||||||
|
|
||||||
|
I = 5
|
||||||
|
I = 60/HH_Coil.get_N() * I
|
||||||
|
print(I)
|
||||||
|
HH_Coil.cooling(I, 25)
|
@ -10,18 +10,21 @@ import logging as log
|
|||||||
from scipy import special as sp
|
from scipy import special as sp
|
||||||
|
|
||||||
import matplotlib
|
import matplotlib
|
||||||
#matplotlib.use('Qt5Agg')
|
# matplotlib.use('Qt5Agg')
|
||||||
#matplotlib.use('Agg')
|
# matplotlib.use('Agg')
|
||||||
#get_ipython().run_line_magic('matplotlib', 'qt')
|
# get_ipython().run_line_magic('matplotlib', 'qt')
|
||||||
# get_ipython().run_line_magic('matplotlib', 'inline')
|
# get_ipython().run_line_magic('matplotlib', 'inline')
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from src import physical_constants as cs
|
from src import physical_constants as cs
|
||||||
|
|
||||||
#logger = log.getLogger('example')
|
# logger = log.getLogger('example')
|
||||||
#log.setLevel(log.info)
|
# log.setLevel(log.info)
|
||||||
log.basicConfig(level = log.ERROR, format = '%(message)s')
|
log.basicConfig(level=log.WARNING, format='%(message)s')
|
||||||
|
|
||||||
|
|
||||||
# TODO: Docstrings for every function
|
# TODO: Docstrings for every function
|
||||||
|
|
||||||
# TODO: Implement conventions
|
# TODO: Implement conventions
|
||||||
|
|
||||||
class BCoil:
|
class BCoil:
|
||||||
@ -36,7 +39,7 @@ class BCoil:
|
|||||||
:param windings: number of axial (vertical) layers
|
:param windings: number of axial (vertical) layers
|
||||||
:param wire_width: width of conductive wire core
|
:param wire_width: width of conductive wire core
|
||||||
:param wire_height: height of conductive wire core
|
:param wire_height: height of conductive wire core
|
||||||
:param insulation_thickness: thickness of wire insulation
|
:param insulation_thickness: thickness of wire insulation (radial increase of thickness not diameter!)
|
||||||
:param is_round: True --> Round wire, False --> rectangular wire
|
:param is_round: True --> Round wire, False --> rectangular wire
|
||||||
:param winding_scheme: 0: standard, layer on layer, 1: with offset (for round wires primarily), 2: like 1, but alternatingly 8 --> 7 windings per layer
|
:param winding_scheme: 0: standard, layer on layer, 1: with offset (for round wires primarily), 2: like 1, but alternatingly 8 --> 7 windings per layer
|
||||||
"""
|
"""
|
||||||
@ -46,6 +49,7 @@ class BCoil:
|
|||||||
if is_round:
|
if is_round:
|
||||||
if wire_width != wire_height:
|
if wire_width != wire_height:
|
||||||
log.error('Wire is round but width != height')
|
log.error('Wire is round but width != height')
|
||||||
|
raise ValueError("Wire is round but width != height")
|
||||||
|
|
||||||
self.HH = HH
|
self.HH = HH
|
||||||
self.distance = distance * 1e-3
|
self.distance = distance * 1e-3
|
||||||
@ -57,6 +61,74 @@ class BCoil:
|
|||||||
self.insulation_thickness = insulation_thickness * 1e-3
|
self.insulation_thickness = insulation_thickness * 1e-3
|
||||||
self.is_round = is_round
|
self.is_round = is_round
|
||||||
self.winding_scheme = winding_scheme
|
self.winding_scheme = winding_scheme
|
||||||
|
# Standard get/set functions
|
||||||
|
@property
|
||||||
|
def get_HH(self):
|
||||||
|
return self.HH
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_distance(self):
|
||||||
|
return self.distance
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_radius(self):
|
||||||
|
return self.radius
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_layers(self):
|
||||||
|
return self.layers
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_windings(self):
|
||||||
|
return self.windings
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_wire_width(self):
|
||||||
|
return wire_width
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_wire_height(self):
|
||||||
|
return self.wire_height
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_insulation_thickness(self):
|
||||||
|
return self.insulation_thickness
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_is_round(self):
|
||||||
|
return self.is_round
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_winding_scheme(self):
|
||||||
|
return self.winding_scheme
|
||||||
|
|
||||||
|
def get_zmin(self):
|
||||||
|
return self.distance / 2 - self.get_coil_height() / 2
|
||||||
|
|
||||||
|
def get_zmax(self):
|
||||||
|
return self.distance / 2 + self.get_coil_height() / 2
|
||||||
|
|
||||||
|
def get_R_inner(self):
|
||||||
|
return self.radius - self.get_coil_width() / 2
|
||||||
|
|
||||||
|
def get_R_outer(self):
|
||||||
|
return self.radius + self.get_coil_width() / 2
|
||||||
|
|
||||||
|
def set_R_outer(self, R_outer):
|
||||||
|
R_outer *= 1e-3
|
||||||
|
self.radius = R_outer - self.get_coil_width() / 2
|
||||||
|
|
||||||
|
def set_R_inner(self, R_inner):
|
||||||
|
R_inner *= 1e-3
|
||||||
|
self.radius = R_inner + self.get_coil_width() / 2
|
||||||
|
|
||||||
|
def set_d_min(self, d_min):
|
||||||
|
d_min *= 1e-3
|
||||||
|
self.distance = d_min + self.get_coil_height()
|
||||||
|
|
||||||
|
def set_d_max(self, d_max):
|
||||||
|
d_max *= 1e-3
|
||||||
|
self.distance = d_max - self.get_coil_height()
|
||||||
|
|
||||||
def get_wire_area(self):
|
def get_wire_area(self):
|
||||||
"""
|
"""
|
||||||
@ -72,9 +144,10 @@ class BCoil:
|
|||||||
Calculates number of windings
|
Calculates number of windings
|
||||||
"""
|
"""
|
||||||
N = self.layers * self.windings
|
N = self.layers * self.windings
|
||||||
|
log.debug(f"N = {N}")
|
||||||
if self.winding_scheme == 2:
|
if self.winding_scheme == 2:
|
||||||
N -= self.windings//2
|
N -= self.layers // 2
|
||||||
|
log.debug(f"N = {N}")
|
||||||
return N
|
return N
|
||||||
|
|
||||||
def get_wire_length(self):
|
def get_wire_length(self):
|
||||||
@ -102,39 +175,10 @@ class BCoil:
|
|||||||
log.info("Coil width: Be aware of the fact that this is an idealized situation of coil winding (slope "
|
log.info("Coil width: Be aware of the fact that this is an idealized situation of coil winding (slope "
|
||||||
"of windings changes each layer)")
|
"of windings changes each layer)")
|
||||||
return self.layers * self.get_tot_wire_width() - (self.layers - 1) * (
|
return self.layers * self.get_tot_wire_width() - (self.layers - 1) * (
|
||||||
2 - np.sqrt(3)) * self.get_tot_wire_width() / 2 # width is reduced due to winding offset
|
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
|
return self.get_tot_wire_width() * self.layers
|
||||||
|
|
||||||
def get_zmin(self):
|
|
||||||
return self.distance / 2 - self.get_coil_height() / 2
|
|
||||||
|
|
||||||
def get_zmax(self):
|
|
||||||
return self.distance / 2 + self.get_coil_height() / 2
|
|
||||||
|
|
||||||
def get_radius(self):
|
|
||||||
return self.radius
|
|
||||||
|
|
||||||
def get_R_inner(self):
|
|
||||||
return self.radius - self.get_coil_width() / 2
|
|
||||||
|
|
||||||
def get_R_outer(self):
|
|
||||||
return self.radius + self.get_coil_width() / 2
|
|
||||||
|
|
||||||
def set_R_outer(self, R_outer):
|
|
||||||
R_outer *= 1e-3
|
|
||||||
self.radius = R_outer - self.get_coil_width() / 2
|
|
||||||
|
|
||||||
def set_R_inner(self, R_inner):
|
|
||||||
R_inner *= 1e-3
|
|
||||||
self.radius = R_inner + self.get_coil_width() / 2
|
|
||||||
|
|
||||||
def set_d_min(self, d_min):
|
|
||||||
d_min *= 1e-3
|
|
||||||
self.distance = d_min + self.get_coil_height()
|
|
||||||
|
|
||||||
def set_d_max(self, d_max):
|
|
||||||
d_max *= 1e-3
|
|
||||||
self.distance = d_max - self.get_coil_height()
|
|
||||||
|
|
||||||
def winding_raster(self):
|
def winding_raster(self):
|
||||||
"""
|
"""
|
||||||
@ -146,11 +190,11 @@ class BCoil:
|
|||||||
it = 0
|
it = 0
|
||||||
z_start = self.get_zmin() + self.get_tot_wire_height() / 2 # (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3
|
z_start = self.get_zmin() + self.get_tot_wire_height() / 2 # (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3
|
||||||
R_start = self.get_R_inner() + self.get_tot_wire_width() / 2 # (R_inner + wire_width/2 )
|
R_start = self.get_R_inner() + self.get_tot_wire_width() / 2 # (R_inner + wire_width/2 )
|
||||||
|
log.debug(f"N = {self.get_N()}")
|
||||||
for xx in range(0, self.layers):
|
for xx in range(0, self.layers):
|
||||||
for zz in range(0, self.windings):
|
for zz in range(0, self.windings):
|
||||||
if self.winding_scheme == 2 and xx % 2 == 1 and zz == self.windings-1:
|
if self.winding_scheme == 2 and xx % 2 == 1 and zz == self.windings - 1:
|
||||||
continue # leave out every last winding in every second layer
|
continue # leave out every last winding in every second layer
|
||||||
z_pos = z_start + zz * self.get_tot_wire_height()
|
z_pos = z_start + zz * self.get_tot_wire_height()
|
||||||
R_pos = R_start + xx * self.get_tot_wire_width()
|
R_pos = R_start + xx * self.get_tot_wire_width()
|
||||||
|
|
||||||
@ -160,8 +204,9 @@ class BCoil:
|
|||||||
z_pos += self.get_tot_wire_height() / 2
|
z_pos += self.get_tot_wire_height() / 2
|
||||||
if self.is_round:
|
if self.is_round:
|
||||||
R_pos -= xx * ((2 - np.sqrt(3)) * self.get_tot_wire_width() / 2)
|
R_pos -= xx * ((2 - np.sqrt(3)) * self.get_tot_wire_width() / 2)
|
||||||
|
log.debug(f"lay = {xx}, wind = {zz}")
|
||||||
outer_raster[it] = [z_pos, R_pos]
|
outer_raster[it] = [z_pos, R_pos]
|
||||||
#print(outer_raster[it])
|
# print(outer_raster[it])
|
||||||
it += 1
|
it += 1
|
||||||
|
|
||||||
return outer_raster
|
return outer_raster
|
||||||
@ -179,11 +224,12 @@ class BCoil:
|
|||||||
log.info("raster value is 0 increased to 1")
|
log.info("raster value is 0 increased to 1")
|
||||||
|
|
||||||
if raster_value == 1:
|
if raster_value == 1:
|
||||||
return [0,0]
|
return [0, 0]
|
||||||
|
|
||||||
if self.is_round & (raster_value % 2 == 0):
|
if self.is_round & (raster_value % 2 == 0):
|
||||||
raster_value += 1
|
raster_value += 1
|
||||||
log.info(f"for round wire rastering works better with uneven rastering value --> rastering value set to: {raster_value}")
|
log.info(
|
||||||
|
f"for round wire rastering works better with uneven rastering value --> rastering value set to: {raster_value}")
|
||||||
|
|
||||||
inner_raster = np.zeros((raster_value ** 2, 2))
|
inner_raster = np.zeros((raster_value ** 2, 2))
|
||||||
it = 0
|
it = 0
|
||||||
@ -225,7 +271,7 @@ class BCoil:
|
|||||||
|
|
||||||
return full_ras
|
return full_ras
|
||||||
|
|
||||||
def plot_raster(self, raster_value = 100):
|
def plot_raster(self, raster_value=100):
|
||||||
full_structure = self.full_raster(raster_value) * 1e3
|
full_structure = self.full_raster(raster_value) * 1e3
|
||||||
if self.get_coil_width() > self.get_coil_height():
|
if self.get_coil_width() > self.get_coil_height():
|
||||||
extension = self.get_coil_width()
|
extension = self.get_coil_width()
|
||||||
@ -237,13 +283,12 @@ class BCoil:
|
|||||||
plt.scatter(full_structure[:, :, 1], full_structure[:, :, 0], linewidths=0.001)
|
plt.scatter(full_structure[:, :, 1], full_structure[:, :, 0], linewidths=0.001)
|
||||||
plt.xlabel("radius [mm]")
|
plt.xlabel("radius [mm]")
|
||||||
plt.ylabel("z position [mm]")
|
plt.ylabel("z position [mm]")
|
||||||
plt.axvline(x=self.get_R_inner()*1e3-0.1, lw = 5,color = "red")
|
plt.axvline(x=self.get_R_inner() * 1e3 - 0.1, lw=5, color="red")
|
||||||
plt.xlim(1e3 * self.get_R_inner() - 0.5, 1e3 * self.get_R_inner() + extension + 0.5)
|
plt.xlim(1e3 * self.get_R_inner() - 0.5, 1e3 * self.get_R_inner() + extension + 0.5)
|
||||||
plt.ylim(1e3 * self.get_zmin() - 0.5, 1e3 * self.get_zmin() + extension + 0.5)
|
plt.ylim(1e3 * self.get_zmin() - 0.5, 1e3 * self.get_zmin() + extension + 0.5)
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
def print_info(self):
|
def print_info(self):
|
||||||
print(" ")
|
print(" ")
|
||||||
# print(f"{self.get_zmin()}")
|
# print(f"{self.get_zmin()}")
|
||||||
@ -426,7 +471,7 @@ class BCoil:
|
|||||||
|
|
||||||
I_current /= rastering_value # divide current into smaller currents for mapping the whole wire
|
I_current /= rastering_value # divide current into smaller currents for mapping the whole wire
|
||||||
# start = time.time()
|
# start = time.time()
|
||||||
for el in range(0,len(x_SI)):
|
for el in range(0, len(x_SI)):
|
||||||
for wire in range(0, self.get_N()):
|
for wire in range(0, self.get_N()):
|
||||||
for ii in range(0, rastering_value):
|
for ii in range(0, rastering_value):
|
||||||
# extract position information out of raster
|
# extract position information out of raster
|
||||||
@ -486,7 +531,7 @@ class BCoil:
|
|||||||
def grad(B_f, z):
|
def grad(B_f, z):
|
||||||
return np.gradient(B_f, z) * 1e1
|
return np.gradient(B_f, z) * 1e1
|
||||||
|
|
||||||
def B_quick_plot(self, I_current, abs = True, x_lim = 50, z_lim = 50, nr_points = 200):
|
def B_quick_plot(self, I_current, abs=True, x_lim=50, z_lim=50, nr_points=200):
|
||||||
x = np.linspace(-x_lim, x_lim, nr_points)
|
x = np.linspace(-x_lim, x_lim, nr_points)
|
||||||
z = np.linspace(-z_lim, z_lim, nr_points)
|
z = np.linspace(-z_lim, z_lim, nr_points)
|
||||||
if abs:
|
if abs:
|
||||||
@ -496,15 +541,14 @@ class BCoil:
|
|||||||
|
|
||||||
plt.figure(11)
|
plt.figure(11)
|
||||||
plt.plot(z, B_z, linestyle="solid", label=r"$B_{tot}$ along z-axis")
|
plt.plot(z, B_z, linestyle="solid", label=r"$B_{tot}$ along z-axis")
|
||||||
plt.plot(x, B_x, label = r"$B_{tot}$ along x-axis")
|
plt.plot(x, B_x, label=r"$B_{tot}$ along x-axis")
|
||||||
plt.title("B-field")
|
plt.title("B-field")
|
||||||
plt.ylabel(r"B-field [G]")
|
plt.ylabel(r"B-field [G]")
|
||||||
plt.xlabel("x-axis / z-axis [mm]")
|
plt.xlabel("x-axis / z-axis [mm]")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
def B_grad_quick_plot(self, I_current, x_lim=50, z_lim=50, nr_points=200):
|
||||||
def B_grad_quick_plot(self, I_current, x_lim = 50, z_lim = 50, nr_points = 200):
|
|
||||||
x = np.linspace(-x_lim, x_lim, nr_points)
|
x = np.linspace(-x_lim, x_lim, nr_points)
|
||||||
z = np.linspace(-z_lim, z_lim, nr_points)
|
z = np.linspace(-z_lim, z_lim, nr_points)
|
||||||
|
|
||||||
@ -514,10 +558,10 @@ class BCoil:
|
|||||||
B_x = BCoil.grad(B_x, x)
|
B_x = BCoil.grad(B_x, x)
|
||||||
|
|
||||||
plt.figure(12)
|
plt.figure(12)
|
||||||
plt.plot(z, B_z, linestyle="solid", label=r"$B_{tot}$ along z-axis")
|
plt.plot(z, B_z, linestyle="solid", label=r"z grad of B_z along z-axis")
|
||||||
plt.plot(x, B_x, label=r"$B_{tot}$ along x-axis")
|
plt.plot(x, B_x, label=r"x Grad of B_x along x-axis")
|
||||||
plt.title("Gradient of B-field")
|
plt.title("Gradient of B-field")
|
||||||
plt.ylabel(r"B-field [G]")
|
plt.ylabel(r"B-field [G/cm]")
|
||||||
plt.xlabel("x-axis / z-axis [mm]")
|
plt.xlabel("x-axis / z-axis [mm]")
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.show()
|
plt.show()
|
||||||
@ -539,7 +583,6 @@ class BCoil:
|
|||||||
plt.legend()
|
plt.legend()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
def Bz_plot_HH_comp(self, Coil2, I_current, x, z):
|
def Bz_plot_HH_comp(self, Coil2, I_current, x, z):
|
||||||
B_z, B_x = self.B_field(I_current, x, z)
|
B_z, B_x = self.B_field(I_current, x, z)
|
||||||
B_z_2, B_x_2 = Coil2.B_field(I_current, x, z)
|
B_z_2, B_x_2 = Coil2.B_field(I_current, x, z)
|
||||||
@ -576,6 +619,7 @@ class BCoil:
|
|||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
def cooling(self, I_current, T):
|
def cooling(self, I_current, T):
|
||||||
"""
|
"""
|
||||||
Print current density and power
|
Print current density and power
|
||||||
@ -593,10 +637,10 @@ class BCoil:
|
|||||||
|
|
||||||
j_dens = I_current / self.get_wire_area() * 1e-6
|
j_dens = I_current / self.get_wire_area() * 1e-6
|
||||||
|
|
||||||
Power = self.resistance(T) * I_current ** 2
|
Power = self.power(I_current, T)
|
||||||
|
|
||||||
print(f"current density = {j_dens} A/mm^2")
|
print(f" current density = {j_dens} A/mm^2")
|
||||||
print(f"Power = {Power} W")
|
print(f" Power = {Power} W")
|
||||||
|
|
||||||
def power(self, I_current, T):
|
def power(self, I_current, T):
|
||||||
P = self.resistance(T) * I_current ** 2
|
P = self.resistance(T) * I_current ** 2
|
||||||
@ -641,39 +685,10 @@ class BCoil:
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
HH_Coil = BCoil(HH=-1, distance=50, radius=40, layers=7, windings=7, wire_height=0.5, wire_width=0.5,
|
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)
|
||||||
insulation_thickness=0.1, is_round = True, winding_scheme=2)
|
Coil_1.plot_raster()
|
||||||
#HH_Coil.get_coil_width()
|
|
||||||
#ras = HH_Coil.full_raster(raster_value = 3)
|
|
||||||
# print(HH_Coil.is_round)
|
|
||||||
#print(HH_Coil.winding_raster())
|
|
||||||
|
|
||||||
|
# main()
|
||||||
HH_Coil.plot_raster(30)
|
|
||||||
print(HH_Coil.get_N())
|
|
||||||
#
|
|
||||||
# HH_Coil.B_quick_plot(1.25, abs = False)
|
|
||||||
# HH_Coil.B_grad_quick_plot(1.25)
|
|
||||||
# HH_Coil.B_curv_quick_plot(1.25)
|
|
||||||
# if True & 1 == 1:
|
|
||||||
# print("test")
|
|
||||||
#print(ras)
|
|
||||||
# x = np.linspace(-50, 50, 300)
|
|
||||||
# z = np.linspace(-50, 50, 300)
|
|
||||||
# Bz, Bx = HH_Coil.B_tot_along_axis(1.25, x, z)
|
|
||||||
# # Bz, Bx = HH_Coil.B_tot_along_axis(1.25, x, z)
|
|
||||||
# # #print(Bx)
|
|
||||||
# # #print(Bz)
|
|
||||||
# plt.plot(x,Bx,label = "Bx")
|
|
||||||
# plt.plot(z,Bz, label = "Bz")
|
|
||||||
# plt.legend()
|
|
||||||
# plt.show()
|
|
||||||
#
|
|
||||||
# HH_Coil.plot_raster(3)
|
|
||||||
# ras = HH_Coil.full_raster(10)
|
|
||||||
#HH_Coil.plot_3d(1.25,50,50)
|
|
||||||
|
|
||||||
#main()
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
log.info("Run main Coil class")
|
log.info("Run main Coil class")
|
||||||
main()
|
main()
|
||||||
|
@ -33,4 +33,4 @@ print(30/400)
|
|||||||
|
|
||||||
print(4.3*4.8/(60*(0.475/2)**2 *np.pi))
|
print(4.3*4.8/(60*(0.475/2)**2 *np.pi))
|
||||||
|
|
||||||
print(1/1.94)
|
print(np.sin(np.radians(90)))
|
Loading…
Reference in New Issue
Block a user