diff --git a/Coil_geometry/12_Final_Plotting.py b/Coil_geometry/12_Final_Plotting.py index ab4916c..4c737b3 100644 --- a/Coil_geometry/12_Final_Plotting.py +++ b/Coil_geometry/12_Final_Plotting.py @@ -13,7 +13,7 @@ import numpy as np 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', 'qt') #get_ipython().run_line_magic('matplotlib', 'inline') #set up axis @@ -25,10 +25,14 @@ z = np.linspace(-5, 5, axis) #New coil I_current = 10 -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) +HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 2, wire_height = 2, wire_width = 1, insulation_thickness= 0.1) HH_Coil.set_R_inner(44.5) HH_Coil.set_d_min(48.8) +HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 8, windings = 8, wire_height = 0.4, wire_width = 0.4,insulation_thickness= 0.1,is_round = False, winding_offset= False) +HH_Coil.set_R_outer(49.3) +HH_Coil.set_d_min(49.8) + print(HH_Coil.resistance(22)) print(HH_Coil.induct_perry()) diff --git a/Coil_geometry/13_Properties_new_HH_coil_incr_N.py b/Coil_geometry/13_Properties_new_HH_coil_incr_N.py index c7ab651..a396483 100644 --- a/Coil_geometry/13_Properties_new_HH_coil_incr_N.py +++ b/Coil_geometry/13_Properties_new_HH_coil_incr_N.py @@ -11,14 +11,16 @@ import numpy as np 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', 'qt') I = 1.25 -HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 8, windings = 8, wire_height = 0.5, wire_width = 0.5,windings_spacing=0.2, layers_spacing = 0.2,is_round = False) +HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 8, windings = 8, wire_height = 0.4, wire_width = 0.4,insulation_thickness= 0.1,is_round = False, winding_offset= False) HH_Coil.set_R_outer(49.3) HH_Coil.set_d_min(49.8) HH_Coil.print_info() -HH_Coil.cooling(I,22.5) +#HH_Coil.cooling(I,22.5) + +HH_Coil.plot_raster(30) diff --git a/src/coil_class.py b/src/coil_class.py index e6dc261..b5dc789 100644 --- a/src/coil_class.py +++ b/src/coil_class.py @@ -88,7 +88,7 @@ class BCoil: def get_coil_width(self): if self.winding_offset: if self.is_round: - log.info("Be aware of the fact that this is a highly idealized situation of coil winding (slope of windings change each layer)") + log.info("Be aware of the fact that this is an idealized situation of coil winding (slope of windings changes each layer)") 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 return self.get_tot_wire_width() * self.layers @@ -129,7 +129,6 @@ class BCoil: :param raster_value: wire height/raster_value is distance between rastered points in one wire :return: 2 dim array [[z1,R1], [z2,R2], ...] """ - outer_raster = np.zeros((self.get_N(),2)) 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 @@ -154,15 +153,11 @@ class BCoil: def inner_raster(self, raster_value): """ - Gives back inner raster for one wire around pos + Gives back inner raster for one wire around 0,0 Args: - pos: [z_pos, r_pos] - raster_value: if N produces a N x N raster for rectangular and cut out of this for round - - Returns: array containing raster around [[z_pos_in_1,r_pos_in_1],...] + raster_value (int): if N produces a N x N raster for rectangular and cut out of this for round + Returns: array containing raster around 0,0 [[z_pos_in_1,r_pos_in_1],...] """ - if raster_value ==1: - return pos inner_raster = np.zeros((raster_value**2,2)) it = 0 @@ -173,10 +168,45 @@ class BCoil: inner_raster[it] = [z_pos_in, r_pos_in] it += 1 + + #delete points out of round geometry + if self.is_round: + delete_list = [] + for i in range(0, len(inner_raster)): + abs = np.sqrt(inner_raster[i, 0]**2 + inner_raster[i, 1]**2) + if abs > self.wire_width/2: + delete_list.append(i) + inner_raster = np.delete(inner_raster, delete_list,axis = 0) + return inner_raster - def inner_raster_pos + def full_raster(self, raster_value): + """ + Args: + raster_value: rastering value + + Returns: [ wire 1:[[z_in1,r_in2], [z_in2,r_in,2],...],wire 2:[ [,] , ]...]...] + + """ + outer_ras = self.winding_raster() + inner_ras = self.inner_raster(raster_value) + full_ras = np.zeros((len(outer_ras),len(inner_ras),2)) + + for i in range(0,len(full_ras)): + full_ras[i] = outer_ras[i] + inner_ras + + return full_ras + + def plot_raster(self, raster_value): + full_structure = self.full_raster(raster_value) * 1e3 + + plt.figure(77) + plt.scatter(full_structure[:,:,1],full_structure[:,:,0]) + plt.xlabel("radius [mm]") + plt.ylabel("z position [mm]") + plt.show() + plt.close(77) def print_info(self): print(" ") @@ -548,17 +578,19 @@ class BCoil: ------- double resistance in Ohm - """ - return cf.resistivity_copper(T) * self.get_wire_length() / self.get_wire_area() + + return BCoil.resistivity_copper(T) * self.get_wire_length() / self.get_wire_area() -HH_Coil = BCoil(HH=1, distance=10, radius=10, layers=2, windings=2, wire_height=1.5, wire_width=2.5, - insulation_thickness=0.25, is_round=False, winding_offset=False) - -pos = [1,7] -print(HH_Coil.inner_raster(pos,10)) +HH_Coil = BCoil(HH=1, distance=50, radius=40, layers=4, windings=4, wire_height=2, wire_width=1.5, + insulation_thickness=0.1, is_round=True, winding_offset=False) +HH_Coil.set_R_outer(70) +HH_Coil.print_info() +raster = HH_Coil.full_raster(10) + +#print(raster[:,:,0])