From 80aec59c322df33772a0cc10241e6b0301f8b1b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joschka=20Sch=C3=B6ner?= Date: Wed, 23 Feb 2022 14:45:46 +0100 Subject: [PATCH] Added final coil configuration + cut off frequency calculation --- .../00_First tests.py | 50 ++++++++++++------- FINAL_Coil/FINAL_COIL_configuration.py | 24 +++++++++ src/coil_class.py | 42 ++++++++++------ time_response/02_frequency_response.py | 31 ++++++++++++ 4 files changed, 115 insertions(+), 32 deletions(-) create mode 100644 FINAL_Coil/FINAL_COIL_configuration.py create mode 100644 time_response/02_frequency_response.py diff --git a/Coil_geometry/New intermediate pair of coils/00_First tests.py b/Coil_geometry/New intermediate pair of coils/00_First tests.py index 725e366..1fdf43c 100644 --- a/Coil_geometry/New intermediate pair of coils/00_First tests.py +++ b/Coil_geometry/New intermediate pair of coils/00_First tests.py @@ -15,39 +15,53 @@ def mu_it(x_pos): return it -Wires = [[0.45, 0.514],[0.475, 0.543],[0.5, 0.568]] Wire_1 = [0.5, 0.546] scale = 10 #I_current = 0.94 -HH_Coil = BC.BCoil(HH = 1, distance = 80, radius = 80, layers = 8, windings = 9, wire_height = Wire_1[0], +HH_Coil = BC.BCoil(HH = 1, distance = 80, radius = 80, 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) -HH_Coil.set_R_inner(83.3) +HH_Coil.set_R_inner(83.3-5) HH_Coil.set_d_min(70.6 + 4) print(HH_Coil.get_wire_length()) -HH_Coil.print_info() +HH_Coil.print_basic_info() -I = 0.67 -# HH_Coil.B_quick_plot(I,nr_points=scale) -# HH_Coil.B_curv_quick_plot(I,nr_points = scale) +I = 0.75 +HH_Coil.B_quick_plot(I) +HH_Coil.B_curv_quick_plot(I) HH_Coil.cooling(I,23) - -AHH_Coil = BC.BCoil(HH = -1, distance = 80, radius = 80, layers = 10, windings = 16, wire_height = Wire_1[0], - wire_width = Wire_1[0], insulation_thickness=(Wire_1[1] - Wire_1[0]) / 2, is_round = True, +print(" ") +HH_Coil.max_field(I) +print("\n") +AHH_Coil = BC.BCoil(HH = -1, distance = 80, radius = 80, layers = 10, windings = 10, wire_height = 1.18, + wire_width = 1.18, insulation_thickness=0.06, is_round = True, winding_scheme= 2) -print(AHH_Coil.get_wire_length()) -print(HH_Coil.get_R_inner()*1e3) -AHH_Coil.set_R_inner(HH_Coil.get_R_inner()*1e3) + + +AHH_Coil.set_R_inner(HH_Coil.get_R_inner()*1e3+1) AHH_Coil.set_d_min(HH_Coil.get_zmax()*2 * 1e3 + 4) -AHH_Coil.print_info() +# Position 2 +# AHH_Coil.set_R_inner(62) +# AHH_Coil.set_d_min(116) +# +# print(f"wire length = {AHH_Coil.get_wire_length()} m") -I = 2 -AHH_Coil.B_quick_plot(I) -AHH_Coil.B_grad_quick_plot(I, nr_points = 200) +# AHH_Coil.print_info() + +AHH_Coil.print_basic_info() +I = 1 +#print(f"current I = {I} A") +AHH_Coil.cooling(I,23) +print("") +AHH_Coil.max_gradient(I) +# AHH_Coil.B_quick_plot(I) +# AHH_Coil.B_grad_quick_plot(I, nr_points = 200) #AHH_Coil.B_curv_quick_plot(I, nr_points = scale) -AHH_Coil.cooling(I,23) \ No newline at end of file + +HH_Coil.print_info() +AHH_Coil.print_info() diff --git a/FINAL_Coil/FINAL_COIL_configuration.py b/FINAL_Coil/FINAL_COIL_configuration.py new file mode 100644 index 0000000..687f589 --- /dev/null +++ b/FINAL_Coil/FINAL_COIL_configuration.py @@ -0,0 +1,24 @@ +import matplotlib.pyplot as plt +import numpy as np +import matplotlib +#matplotlib.use('Qt5Agg') +from src import coil_class as BC + + +HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5, + wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True, + winding_scheme= 2) +HH_Coil.set_R_inner(45.6) +HH_Coil.set_d_min(2*24.075) +HH_Coil.print_info() + +AHH_Coil = BC.BCoil(HH = -1, distance = 54, radius = 48, layers = HH_Coil.get_layers, windings=2 * HH_Coil.get_windings, + wire_height = 0.5, wire_width=0.5, insulation_thickness=(0.546-0.5)/2, + is_round = True, winding_scheme= 2) + +AHH_Coil.set_R_inner(45.6) +AHH_Coil.set_d_min(HH_Coil.get_zmax()*2 * 1e3 + 4) + +AHH_Coil.print_info() + +R = HH_Coil.resistance(25) \ No newline at end of file diff --git a/src/coil_class.py b/src/coil_class.py index f218dfd..8c8fc17 100644 --- a/src/coil_class.py +++ b/src/coil_class.py @@ -293,19 +293,32 @@ class BCoil: # print(f"{self.get_zmin()}") # print(self.__name__) print( - f"HH = {self.HH}, Distance = {self.distance * 1e3} mm, z_min = {self.get_zmin() * 1e3} mm, z_max = {self.get_zmax() * 1e3} mm") + f"HH = {self.HH}, Distance = {self.distance * 1e3} mm, z_min = {self.get_zmin() * 1e3:.3f} mm, z_max = {self.get_zmax() * 1e3:.3f} mm") print( - f"Radius = {self.radius * 1e3} mm, Radius_inner = {self.get_R_inner() * 1e3} mm, Radius_outer = {self.get_R_outer() * 1e3:.2f} mm") + f"Radius = {self.radius * 1e3:.3f} mm, Radius_inner = {self.get_R_inner() * 1e3:.3f} mm, Radius_outer = {self.get_R_outer() * 1e3:.3f} mm") print( - f"Coil width = {self.get_coil_width() * 1e3} mm, Coil height = {self.get_coil_height() * 1e3} mm" + f"Coil width = {self.get_coil_width() * 1e3:.3f} mm, Coil height = {self.get_coil_height() * 1e3:.3f} mm" ) print( - f"layers = {self.layers}, windings = {self.windings}, wire_width = {self.wire_width * 1e3}, wire_height = {self.wire_height * 1e3} mm, round wire = {self.is_round} ") + f"layers = {self.layers}, windings = {self.windings}, wire_width = {self.wire_width * 1e3:.3f}, wire_height = {self.wire_height * 1e3:.3f} mm, round wire = {self.is_round} ") print(" ") def print_basic_info(self): + if self.HH == 1: + print("Offset coil:") + else: + print("Gradient coil:") print( - f"HH = {self.HH}, Distance = {self.distance * 1e3} mm, Radius = {self.radius * 1e3} mm,layers = {self.layers}, windings = {self.windings}, round wire = {self.is_round}") + f" layers = {self.layers}, windings = {self.windings} \n " + f" wire: core = {self.wire_height * 1e3:.2f} mm, tot = {self.get_tot_wire_height() * 1e3:.2f} mm, total length for pair = {2 * self.get_wire_length():.0f} m" + ) + print( + f" Distance = {self.distance * 1e3:.2f} mm, Radius = {self.radius * 1e3:.2f} mm" + ) + print( + f" Coil width = {self.get_coil_width() * 1e3:.2f} mm, Coil height = {self.get_coil_height() * 1e3:.2f} mm" + ) + print("") def B_field_ideal_z(self, I_current, z_arg): """ @@ -473,6 +486,7 @@ class BCoil: 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) + print(f" Max Field = {B_z_0:.2f} G") return B_z_0 def max_gradient(self, i_current, raster = 7): @@ -481,9 +495,9 @@ class BCoil: bz_grad = BCoil.grad(Bz, z) bx_grad = BCoil.grad(Bx, x) - print(f"Max z Gradient = {bz_grad[len(z)//2]} G/cm") - print(f"Max x Gradient = {bx_grad[len(x)//2]} G/cm") - #return bx_grad[len(x)//2] + print(f" Max z Gradient = {bz_grad[len(z)//2]:.2f} G/cm") + print(f" Max x Gradient = {bx_grad[len(x)//2]:.2f} G/cm") + # return bx_grad[len(x)//2] @@ -657,7 +671,6 @@ class BCoil: plt.title("Gradient of B-field") plt.ylabel(r"B-field [G/cm]") plt.xlabel("x-axis / z-axis [mm]") - plt.title("Winding scheme AHH-coil") plt.legend() plt.show() @@ -735,11 +748,12 @@ class BCoil: Voltage = self.resistance(T) * I_current - print("") + #print("") print("Cooling:") - print(f" current density = {j_dens} A/mm^2") - print(f" Power = {Power} W") - print(f" U = {Voltage} V") + print(f" Current I = {I_current} A") + print(f" current density = {j_dens:.2f} A/mm^2") + print(f" Power = {Power:.2f} W") + print(f" U = {Voltage:.2f} V") def power(self, I_current, T): """ @@ -753,7 +767,7 @@ class BCoil: def induct_perry(self): """ - Calculates inductance of rectangular coil via empirical formular by perry + Calculates inductance of one rectangular coil via empirical formular by perry """ L = 4 * np.pi * (self.windings * self.layers) ** 2 * (1e2 * self.radius) ** 2 / ( diff --git a/time_response/02_frequency_response.py b/time_response/02_frequency_response.py new file mode 100644 index 0000000..965706d --- /dev/null +++ b/time_response/02_frequency_response.py @@ -0,0 +1,31 @@ +import matplotlib.pyplot as plt +import numpy as np +import matplotlib +#matplotlib.use('Qt5Agg') +from src import coil_class as BC + + +HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5, + wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True, + winding_scheme= 2) +HH_Coil.set_R_inner(45.6) +HH_Coil.set_d_min(2*24.075) +HH_Coil.print_info() + +AHH_Coil = BC.BCoil(HH = -1, distance = 54, radius = 48, layers = HH_Coil.get_layers, windings=2 * HH_Coil.get_windings, + wire_height = 0.5, wire_width=0.5, insulation_thickness=(0.546-0.5)/2, + is_round = True, winding_scheme= 2) + +AHH_Coil.set_R_inner(45.6) +AHH_Coil.set_d_min(HH_Coil.get_zmax()*2 * 1e3 + 4) + +AHH_Coil.print_info() + +R = HH_Coil.resistance(22) +L = HH_Coil.induct_perry() + +f = R/(2*np.pi*L) + +print(f"resistance = {R} Ohm") +print(f"L = {L}") +print(f"cutoff frequency: f = {f} Hz") \ No newline at end of file