def build_geometry(self, alpha=0, delta=0, is_simplified=False): """Compute the curve (Line) needed to plot the Slot. The ending point of a curve is the starting point of the next curve in the list Parameters ---------- self : HoleM52 A HoleM52 object alpha : float Angle to rotate the slot (Default value = 0) [rad] delta : complex Complex to translate the slot (Default value = 0) is_simplified : bool True to avoid line superposition Returns ------- surf_list: list List of SurfLine needed to draw the HoleM51 """ if self.get_is_stator(): # check if the slot is on the stator st = "_Stator" else: st = "_Rotor" Rbo = self.get_Rbo() alpha1 = self.comp_alpha() Z1 = (Rbo - self.H0) * exp(1j * alpha1 / 2) Z9 = (Rbo - self.H0) * exp(-1j * alpha1 / 2) Z0 = (Z1 + Z9) / 2 Z5 = Z0 - self.H1 Z4 = Z5 + 1j * self.W0 / 2 Z6 = Z4.conjugate() Z3 = Z4 + self.H2 Z7 = Z3.conjugate() W1 = self.comp_W1() Z2 = Z3 + 1j * W1 Z8 = Z2.conjugate() Z11 = Z3 + (self.H1 - self.H2) Z10 = Z7 + (self.H1 - self.H2) # Creation of the air curve curve_list_air = list() curve_list_air.append(Segment(Z1, Z2)) curve_list_air.append(Segment(Z2, Z3)) curve_list_air.append(Segment(Z3, Z11)) curve_list_air.append(Segment(Z11, Z1)) point_ref = (Z1 + Z2 + Z3 + Z11) / 4 S1 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Creation of the magnet curve curve_list_mag = list() if is_simplified: curve_list_mag.append(Segment(Z3, Z11)) curve_list_mag.append(Segment(Z7, Z10)) else: curve_list_mag.append(Segment(Z4, Z11)) curve_list_mag.append(Segment(Z11, Z10)) curve_list_mag.append(Segment(Z10, Z6)) curve_list_mag.append(Segment(Z6, Z4)) point_ref = (Z11 + Z4 + Z6 + Z10) / 4 # Defining type of magnetization of the magnet if self.magnet_0: if self.magnet_0.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T0_S0" S2 = SurfLine(line_list=curve_list_mag, label=magnet_label, point_ref=point_ref) # Creation of the second air curve curve_list_air = list() curve_list_air.append(Segment(Z7, Z8)) curve_list_air.append(Segment(Z8, Z9)) curve_list_air.append(Segment(Z9, Z10)) curve_list_air.append(Segment(Z10, Z7)) point_ref = (Z7 + Z8 + Z9 + Z10) / 4 S3 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Area with no magnet (S1 + S2 + S3) curve_list_air = list() curve_list_air.append(Segment(Z1, Z2)) curve_list_air.append(Segment(Z2, Z3)) if self.H2 > 0: curve_list_air.append(Segment(Z3, Z4)) curve_list_air.append(Segment(Z4, Z6)) if self.H2 > 0: curve_list_air.append(Segment(Z6, Z7)) curve_list_air.append(Segment(Z7, Z8)) curve_list_air.append(Segment(Z8, Z9)) curve_list_air.append(Segment(Z9, Z1)) point_ref = (Z11 + Z4 + Z6 + Z10) / 4 S4 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) if self.magnet_0: S1.label = S1.label + "_R0_T0_S0" # Hole S3.label = S3.label + "_R0_T1_S0" # Hole surf_list = [S1, S2, S3] else: S4.label = S4.label + "_R0_T0_S0" # Hole surf_list = [S4] # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry(self, alpha=0, delta=0, is_simplified=False): """Compute the curve (Segment) needed to plot the Slot. The ending point of a curve is the starting point of the next curve in the list Parameters ---------- self : HoleM50 A HoleM50 object alpha : float Angle to rotate the slot (Default value = 0) [rad] delta : complex Complex to translate the slot (Default value = 0) is_simplified : bool True to avoid line superposition Returns ------- surf_list: list List of SurfLine needed to draw the HoleM50 """ if self.get_is_stator(): # check if the slot is on the stator st = "_Stator" else: st = "_Rotor" Rbo = self.get_Rbo() # magnet pole pitch angle, must be <2*pi/2*p alpham = 2 * arcsin(self.W0 / (2 * (Rbo - self.H1))) # angle (Z9,0,Z9') Harc = (Rbo - self.H1) * (1 - cos(alpham / 2)) # alpha on schematics gammam = arctan( (self.H0 - self.H1 - Harc) / (self.W0 / 2.0 - self.W1 / 2.0)) # betam = pi/2-alpham/2-gammam;#40.5 hssp = pi / self.Zh x78 = (self.H3 - self.H2) / cos(gammam) # distance from 7 to 8 Z9 = Rbo - Harc - self.H1 - 1j * self.W0 / 2 Z8 = Rbo - self.H0 - 1j * self.W1 / 2 Z7 = Rbo - self.H0 - x78 - 1j * self.W1 / 2 Z1 = (Rbo - self.H1) * exp(1j * (-hssp + arcsin(self.W3 / (2 * (Rbo - self.H1))))) Z11 = (Z1 * exp(1j * hssp) + self.H4) * exp(-1j * hssp) Z10 = (Z9 * exp(1j * hssp) + self.H4) * exp(-1j * hssp) # Magnet coordinate with Z8 as center and x as the top edge of the magnet Z8b = self.W2 Z8c = Z8b + self.W4 Z5 = Z8b - 1j * self.H3 Z4 = Z8c - 1j * self.H3 Z6 = Z5 + 1j * self.H2 Z3 = Z4 + 1j * self.H2 Zmag = array([Z8b, Z6, Z5, Z4, Z3, Z8c]) Zmag = Zmag * exp(1j * angle(Z9 - Z8)) Zmag = Zmag + Z8 # final complex numbers Zmag=[Z8b Z6 Z5 Z4 Z3 Z8c] (Z8b, Z6, Z5, Z4, Z3, Z8c) = Zmag # Rotation so [Z1,Z2] is parallel to the x axis Z3r, Z1r, Z6r = Z3 * exp(1j * hssp), Z1 * exp(1j * hssp), Z6 * exp( 1j * hssp) # numerical resolution to find the last point Z2 x = fsolve(lambda x: np_imag((Z3r - (Z1r - x)) / (Z6r - Z3r)), self.H3 - self.H2) Z2 = (Z1r - x[0]) * exp(-1j * hssp) # Symmetry Z1s = Z1.conjugate() Z2s = Z2.conjugate() Z3s = Z3.conjugate() Z4s = Z4.conjugate() Z5s = Z5.conjugate() Z6s = Z6.conjugate() Z7s = Z7.conjugate() Z8s = Z8.conjugate() Z9s = Z9.conjugate() Z10s = Z10.conjugate() Z11s = Z11.conjugate() Z8cs = Z8c.conjugate() Z8bs = Z8b.conjugate() surf_list = list() # Create all the surfaces for all the cases # Air surface (W3) with magnet_0 curve_list_air = list() curve_list_air.append(Segment(Z1, Z2)) curve_list_air.append(Segment(Z2, Z3)) curve_list_air.append(Segment(Z3, Z8c)) curve_list_air.append(Segment(Z8c, Z9)) if self.H4 > 0: curve_list_air.append(Segment(Z9, Z10)) curve_list_air.append( Arc1(Z10, Z11, -Rbo + self.H1, is_trigo_direction=False)) if self.H4 > 0: curve_list_air.append(Segment(Z11, Z1)) point_ref = (Z1 + Z2 + Z3 + Z8c + Z9 + Z10 + Z11) / 7 S1 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Magnet_0 surface curve_list_mag = list() if is_simplified: curve_list_mag.append(Segment(Z8c, Z3)) curve_list_mag.append(Segment(Z6, Z8b)) else: if Z3 != Z4: # Z5 == Z6 if H2 = 0 curve_list_mag.append(Segment(Z3, Z4)) curve_list_mag.append(Segment(Z4, Z5)) if Z5 != Z6: # Z5 == Z6 if H2 = 0 curve_list_mag.append(Segment(Z5, Z6)) curve_list_mag.append(Segment(Z6, Z8b)) curve_list_mag.append(Segment(Z8b, Z8c)) curve_list_mag.append(Segment(Z8c, Z3)) point_ref = (Z3 + Z4 + Z5 + Z6 + Z8b + Z8c) / 6 # Defining type of magnetization of the magnet if self.magnet_0: if self.magnet_0.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T0_S0" S2 = SurfLine(line_list=curve_list_mag, label=magnet_label, point_ref=point_ref) # Air surface with magnet_0 and W1 > 0 curve_list_air = list() curve_list_air.append(Segment(Z6, Z7)) curve_list_air.append(Segment(Z7, Z8)) if self.W2 > 0: # if W2=0 Z8 = Z8b curve_list_air.append(Segment(Z8, Z8b)) curve_list_air.append(Segment(Z8b, Z6)) point_ref = (Z6 + Z7 + Z8 + Z8b) / 4 S3 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Symmetry Air surface (W3) with magnet_1 curve_list_air = list() curve_list_air.append(Segment(Z1s, Z2s)) curve_list_air.append(Segment(Z2s, Z3s)) curve_list_air.append(Segment(Z3s, Z8cs)) curve_list_air.append(Segment(Z8cs, Z9s)) if self.H4 > 0: curve_list_air.append(Segment(Z9s, Z10s)) curve_list_air.append( Arc1(Z10s, Z11s, -Rbo + self.H1, is_trigo_direction=False)) if self.H4 > 0: curve_list_air.append(Segment(Z11s, Z1s)) point_ref = (Z1s + Z2s + Z3s + Z8cs + Z9s + Z10s + Z11s) / 7 S4 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # magnet_1 surface curve_list_mag = list() if is_simplified: curve_list_mag.append(Segment(Z8cs, Z3s)) curve_list_mag.append(Segment(Z6s, Z8bs)) else: if Z3s != Z4s: # Z5 == Z6 if H2 = 0 curve_list_mag.append(Segment(Z3s, Z4s)) curve_list_mag.append(Segment(Z4s, Z5s)) if Z5s != Z6s: # Z5 == Z6 if H2 = 0 curve_list_mag.append(Segment(Z5s, Z6s)) curve_list_mag.append(Segment(Z6s, Z8bs)) curve_list_mag.append(Segment(Z8bs, Z8cs)) curve_list_mag.append(Segment(Z8cs, Z3s)) point_ref = (Z3s + Z4s + Z5s + Z6s + Z8bs + Z8cs) / 6 # Defining type of magnetization of the magnet if self.magnet_1: if self.magnet_1.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T1_S0" S5 = SurfLine(line_list=curve_list_mag, label=magnet_label, point_ref=point_ref) # Air surface with magnet_1 and W1 > 0 curve_list_air = list() curve_list_air.append(Segment(Z6s, Z7s)) curve_list_air.append(Segment(Z7s, Z8s)) if self.W2 > 0: # if W2=0: Z8s = Z8bs curve_list_air.append(Segment(Z8s, Z8bs)) curve_list_air.append(Segment(Z8bs, Z6s)) point_ref = (Z6s + Z7s + Z8s + Z8bs) / 4 S6 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air surface both magnet and W1 = 0 (S6 + S3) curve_list_air = list() curve_list_air.append(Segment(Z6, Z7)) curve_list_air.append(Segment(Z7, Z6s)) curve_list_air.append(Segment(Z6s, Z8bs)) if self.W2 > 0: # If W2 = 0: Z8b = Z8 = Z8bs curve_list_air.append(Segment(Z8bs, Z8s)) curve_list_air.append(Segment(Z8s, Z8b)) curve_list_air.append(Segment(Z8b, Z6)) point_ref = (Z6 + Z7 + Z6s + Z8s + Z8bs + Z8b) / 6 S7 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air surface without magnet_0 and W1 > 0 (S1 + S2 + S3) curve_list_air = list() curve_list_air.append(Segment(Z1, Z2)) curve_list_air.append(Segment(Z2, Z3)) if self.H2 > 0: curve_list_air.append(Segment(Z3, Z4)) curve_list_air.append(Segment(Z4, Z5)) if self.H2 > 0: curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append(Segment(Z6, Z7)) curve_list_air.append(Segment(Z7, Z8)) curve_list_air.append(Segment(Z8, Z9)) if self.H4 > 0: curve_list_air.append(Segment(Z9, Z10)) curve_list_air.append( Arc1(Z10, Z11, -Rbo + self.H1, is_trigo_direction=False)) if self.H4 > 0: curve_list_air.append(Segment(Z11, Z1)) point_ref = (Z1 + Z2 + Z3 + Z8c + Z9 + Z10 + Z11) / 7 S8 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air surface without magnet_1 and W1 > 0 curve_list_air = list() curve_list_air.append(Segment(Z1s, Z2s)) curve_list_air.append(Segment(Z2s, Z3s)) if self.H2 > 0: curve_list_air.append(Segment(Z3s, Z4s)) curve_list_air.append(Segment(Z4s, Z5s)) if self.H2 > 0: curve_list_air.append(Segment(Z5s, Z6s)) curve_list_air.append(Segment(Z6s, Z7s)) curve_list_air.append(Segment(Z7s, Z8s)) curve_list_air.append(Segment(Z8s, Z9s)) if self.H4 > 0: curve_list_air.append(Segment(Z9s, Z10s)) curve_list_air.append( Arc1(Z10s, Z11s, -Rbo + self.H1, is_trigo_direction=False)) if self.H4 > 0: curve_list_air.append(Segment(Z11s, Z1s)) point_ref = (Z1s + Z2s + Z3s + Z8cs + Z9s + Z10s + Z11s) / 7 S9 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air surface with magnet_0 without magnet_1 and W1 = 0 # (S4 + S5 + S7) curve_list_air = list() curve_list_air.append(Segment(Z1s, Z2s)) curve_list_air.append(Segment(Z2s, Z3s)) if self.H2 > 0: curve_list_air.append(Segment(Z3s, Z4s)) curve_list_air.append(Segment(Z4s, Z5s)) if self.H2 > 0: curve_list_air.append(Segment(Z5s, Z6s)) curve_list_air.append(Segment(Z6s, Z7s)) curve_list_air.append(Segment(Z7s, Z6)) curve_list_air.append(Segment(Z6, Z8b)) curve_list_air.append(Segment(Z8b, Z8s)) curve_list_air.append(Segment(Z8s, Z9s)) if self.H4 > 0: curve_list_air.append(Segment(Z9s, Z10s)) curve_list_air.append( Arc1(Z10s, Z11s, -Rbo + self.H1, is_trigo_direction=False)) if self.H4 > 0: curve_list_air.append(Segment(Z11s, Z1s)) point_ref = (Z1s + Z2s + Z3s + Z8cs + Z9s + Z10s + Z11s) / 7 S10 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air surface with magnet_1 without magnet_0 and W1 = 0 # (S1 + S2 + S7) curve_list_air = list() curve_list_air.append(Segment(Z1, Z2)) curve_list_air.append(Segment(Z2, Z3)) if self.H2 > 0: curve_list_air.append(Segment(Z3, Z4)) curve_list_air.append(Segment(Z4, Z5)) if self.H2 > 0: curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append(Segment(Z6, Z7)) curve_list_air.append(Segment(Z7, Z6s)) curve_list_air.append(Segment(Z6s, Z8bs)) curve_list_air.append(Segment(Z8bs, Z8)) curve_list_air.append(Segment(Z8, Z9)) if self.H4 > 0: curve_list_air.append(Segment(Z9, Z10)) curve_list_air.append( Arc1(Z10, Z11, -Rbo + self.H1, is_trigo_direction=False)) if self.H4 > 0: curve_list_air.append(Segment(Z11, Z1)) point_ref = (Z1 + Z2 + Z3 + Z8c + Z9 + Z10 + Z11) / 7 S11 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air surface without magnet and W1 = 0 # (S4 + S5 + S7 + S2 + S1) curve_list_air = list() curve_list_air.append(Segment(Z1, Z2)) curve_list_air.append(Segment(Z2, Z3)) if Z3 != Z4: # if H2 = 0 curve_list_air.append(Segment(Z3, Z4)) curve_list_air.append(Segment(Z4, Z5)) if Z5 != Z6: # if H2 = 0 curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append(Segment(Z6, Z7)) curve_list_air.append(Segment(Z7, Z6s)) if Z5s != Z6s: curve_list_air.append(Segment(Z6s, Z5s)) curve_list_air.append(Segment(Z5s, Z4s)) if Z3s != Z4s: curve_list_air.append(Segment(Z4s, Z3s)) curve_list_air.append(Segment(Z3s, Z2s)) curve_list_air.append(Segment(Z2s, Z1s)) if self.H4 > 0: curve_list_air.append(Segment(Z1s, Z11s)) curve_list_air.append( Arc1(Z11s, Z10s, -Rbo + self.H1, is_trigo_direction=False)) if self.H4 > 0: curve_list_air.append(Segment(Z10s, Z9s)) curve_list_air.append(Segment(Z9s, Z8s)) curve_list_air.append(Segment(Z8s, Z9)) if self.H4 > 0: curve_list_air.append(Segment(Z9, Z10)) curve_list_air.append( Arc1(Z10, Z11, -Rbo + self.H1, is_trigo_direction=False)) if self.H4 > 0: curve_list_air.append(Segment(Z11, Z1)) point_ref = (Z6 + Z8b + Z7 + Z8 + Z6s + Z8bs) / 6 S12 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Create the surface list by selecting the correct ones if self.magnet_0 and self.magnet_1 and self.W1 > 0: S1.label = S1.label + "_R0_T0_S0" # Hole S3.label = S3.label + "_R0_T1_S0" # Hole S6.label = S6.label + "_R0_T2_S0" # Hole S4.label = S4.label + "_R0_T3_S0" # Hole surf_list = [S1, S2, S3, S6, S5, S4] elif self.magnet_0 and self.magnet_1 and self.W1 == 0: S1.label = S1.label + "_R0_T0_S0" # Hole S7.label = S7.label + "_R0_T1_S0" # Hole S4.label = S4.label + "_R0_T2_S0" # Hole surf_list = [S1, S2, S7, S5, S4] elif self.magnet_0 and not self.magnet_1 and self.W1 > 0: S1.label = S1.label + "_R0_T0_S0" # Hole S3.label = S3.label + "_R0_T1_S0" # Hole S9.label = S9.label + "_R0_T2_S0" # Hole surf_list = [S1, S2, S3, S9] elif self.magnet_0 and not self.magnet_1 and self.W1 == 0: S1.label = S1.label + "_R0_T0_S0" # Hole S10.label = S10.label + "_R0_T1_S0" # Hole surf_list = [S1, S2, S10] elif not self.magnet_0 and self.magnet_1 and self.W1 > 0: S8.label = S8.label + "_R0_T0_S0" # Hole S6.label = S6.label + "_R0_T1_S0" # Hole S4.label = S4.label + "_R0_T2_S0" # Hole surf_list = [S8, S6, S5, S4] elif not self.magnet_0 and self.magnet_1 and self.W1 == 0: S11.label = S11.label + "_R0_T0_S0" # Hole S4.label = S4.label + "_R0_T1_S0" # Hole surf_list = [S11, S5, S4] elif not self.magnet_0 and not self.magnet_1 and self.W1 > 0: S8.label = S8.label + "_R0_T0_S0" # Hole S9.label = S9.label + "_R0_T1_S0" # Hole surf_list = [S8, S9] elif not self.magnet_0 and not self.magnet_1 and self.W1 == 0: S12.label = S12.label + "_R0_T0_S0" # Hole surf_list = [S12] # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry(self, alpha=0, delta=0, is_simplified=False): """Compute the curve (Segment) needed to plot the Hole. The ending point of a curve is the starting point of the next curve in the list Parameters ---------- self : HoleM53 A HoleM53 object alpha : float Angle to rotate the slot (Default value = 0) [rad] delta : complex Complex to translate the slot (Default value = 0) is_simplified : bool True to avoid line superposition Returns ------- surf_list: list List of Magnet Surface and Air Surface on the slot """ if self.get_is_stator(): # check if the slot is on the stator st = "_Stator" else: st = "_Rotor" Rbo = self.get_Rbo() Z7 = Rbo - self.H0 - 1j * self.W1 / 2 Z6 = Z7 - 1j * (self.H2 - self.H3) * cos(self.W4) Z8 = Z7 + (self.H2 - self.H3) * sin(self.W4) # Compute the coordinate in the ref of Z6 with rotation -W4 Z5 = self.W2 * exp(-1j * self.W4) + Z6 Z4 = (self.W2 - 1j * self.H3) * exp(-1j * self.W4) + Z6 Z3 = (self.W2 + self.W3 - 1j * self.H3) * exp(-1j * self.W4) + Z6 Z2 = (self.W2 + self.W3) * exp(-1j * self.W4) + Z6 Z9 = (self.W2 + 1j * (self.H2 - self.H3)) * exp(-1j * self.W4) + Z6 Z10 = (self.W2 + self.W3 + 1j * (self.H2 - self.H3)) * exp(-1j * self.W4) + Z6 # Z1 and Z11 are defined as intersection between line and circle Zlist = inter_line_circle(Z8, Z10, Rbo - self.H1) if len(Zlist) == 2 and Zlist[0].imag < 0 and Zlist[0].real > 0: Z11 = Zlist[0] elif len(Zlist) == 2 and Zlist[1].imag < 0 and Zlist[1].real > 0: Z11 = Zlist[1] else: raise Slot53InterError("ERROR: Slot 53, Can't find Z11 coordinates") Zlist = inter_line_circle(Z2, Z6, Rbo - self.H1) if len(Zlist) == 2 and Zlist[0].imag < 0 and Zlist[0].real > 0: Z1 = Zlist[0] elif len(Zlist) == 2 and Zlist[1].imag < 0 and Zlist[1].real > 0: Z1 = Zlist[1] else: raise Slot53InterError("ERROR: Slot 53, Can't find Z1 coordinates") # Symmetry Z1s = Z1.conjugate() Z2s = Z2.conjugate() Z3s = Z3.conjugate() Z4s = Z4.conjugate() Z5s = Z5.conjugate() Z6s = Z6.conjugate() Z7s = Z7.conjugate() Z8s = Z8.conjugate() Z9s = Z9.conjugate() Z10s = Z10.conjugate() Z11s = Z11.conjugate() # Air surface with magnet_0 curve_list_air = list() curve_list_air.append(Segment(Z1, Z2)) curve_list_air.append(Segment(Z2, Z10)) curve_list_air.append(Segment(Z10, Z11)) curve_list_air.append(Arc1(Z11, Z1, -Rbo + self.H1)) point_ref = (Z1 + Z2 + Z10 + Z11) / 4 S1 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # magnet_0 surface curve_list_mag = list() if is_simplified: curve_list_air.append(Segment(Z5, Z9)) curve_list_air.append(Segment(Z2, Z10)) else: curve_list_mag.append(Segment(Z3, Z4)) curve_list_mag.append(Segment(Z4, Z9)) curve_list_mag.append(Segment(Z9, Z10)) curve_list_mag.append(Segment(Z10, Z3)) point_ref = (Z3 + Z4 + Z9 + Z10) / 4 # Defining type of magnetization of the magnet if self.magnet_0: if self.magnet_0.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T0_S0" S2 = SurfLine(line_list=curve_list_mag, label=magnet_label, point_ref=point_ref) # Air suface with magnet_0 and W1 > 0 curve_list_air = list() if self.W2 > 0: curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append(Segment(Z6, Z7)) curve_list_air.append(Segment(Z7, Z8)) if self.W2 > 0: curve_list_air.append(Segment(Z8, Z9)) curve_list_air.append(Segment(Z9, Z5)) point_ref = (Z5 + Z6 + Z7 + Z8 + Z9) / 5 else: curve_list_air.append(Segment(Z8, Z6)) point_ref = (Z6 + Z7 + Z8) / 3 S3 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air surface with magnet_1 curve_list_air = list() curve_list_air.append(Segment(Z1s, Z2s)) curve_list_air.append(Segment(Z2s, Z10s)) curve_list_air.append(Segment(Z10s, Z11s)) curve_list_air.append(Arc1(Z11s, Z1s, Rbo - self.H1)) point_ref = (Z1s + Z2s + Z10s + Z11s) / 4 S4 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # magnet_1 surface curve_list_mag = list() if is_simplified: curve_list_air.append(Segment(Z5s, Z9s)) curve_list_air.append(Segment(Z2s, Z10s)) else: curve_list_mag.append(Segment(Z3s, Z4s)) curve_list_mag.append(Segment(Z4s, Z9s)) curve_list_mag.append(Segment(Z9s, Z10s)) curve_list_mag.append(Segment(Z10s, Z3s)) point_ref = (Z3s + Z4s + Z9s + Z10s) / 4 # Defining type of magnetization of the magnet if self.magnet_1: if self.magnet_1.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T1_S0" S5 = SurfLine(line_list=curve_list_mag, label=magnet_label, point_ref=point_ref) # Air suface with magnet_1 and W1 > 0 curve_list_air = list() if self.W2 > 0: curve_list_air.append(Segment(Z5s, Z6s)) curve_list_air.append(Segment(Z6s, Z7s)) curve_list_air.append(Segment(Z7s, Z8s)) if self.W2 > 0: curve_list_air.append(Segment(Z8s, Z9s)) curve_list_air.append(Segment(Z9s, Z5s)) point_ref = (Z5s + Z6s + Z7s + Z8s + Z9s) / 5 else: curve_list_air.append(Segment(Z8s, Z6s)) point_ref = (Z6s + Z7s + Z8s) / 3 S6 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air with both magnet and W1 = 0 curve_list_air = list() if self.W2 > 0: curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append(Segment(Z6, Z6s)) if self.W2 > 0: curve_list_air.append(Segment(Z6s, Z5s)) curve_list_air.append(Segment(Z5s, Z9s)) if self.W2 > 0: curve_list_air.append(Segment(Z9s, Z8s)) curve_list_air.append(Segment(Z8s, Z9)) curve_list_air.append(Segment(Z9, Z5)) point_ref = (Z6 + Z6s + Z8) / 3 S7 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # first hole without magnet_0 and W1 > 0 curve_list_mag = list() curve_list_mag.append(Segment(Z1, Z2)) if self.H3 > 0: curve_list_mag.append(Segment(Z2, Z3)) curve_list_mag.append(Segment(Z3, Z4)) if self.H3 > 0: curve_list_mag.append(Segment(Z4, Z5)) if self.W2 > 0: curve_list_mag.append(Segment(Z5, Z6)) curve_list_mag.append(Segment(Z6, Z7)) curve_list_mag.append(Segment(Z7, Z8)) curve_list_mag.append(Segment(Z8, Z11)) curve_list_air.append(Arc1(Z11, Z1, -Rbo + self.H1)) point_ref = (Z3 + Z4 + Z9 + Z10) / 4 S8 = SurfLine(line_list=curve_list_mag, label="Hole" + st, point_ref=point_ref) # second hole without magnet_1 and W1 > 0 curve_list_mag = list() curve_list_mag.append(Segment(Z1s, Z2s)) if self.H3 > 0: curve_list_mag.append(Segment(Z2s, Z3s)) curve_list_mag.append(Segment(Z3s, Z4s)) if self.H3 > 0: curve_list_mag.append(Segment(Z4s, Z5s)) if self.W2 > 0: curve_list_mag.append(Segment(Z5s, Z6s)) curve_list_mag.append(Segment(Z6s, Z7s)) curve_list_mag.append(Segment(Z7s, Z8s)) curve_list_mag.append(Segment(Z8s, Z11s)) curve_list_air.append(Arc1(Z11s, Z1s, -Rbo + self.H1)) point_ref = (Z3s + Z4s + Z9s + Z10s) / 4 S9 = SurfLine(line_list=curve_list_mag, label="Hole" + st, point_ref=point_ref) # No magnet_1 and W1 = 0 curve_list_mag = list() curve_list_mag.append(Segment(Z1s, Z2s)) if self.H3 > 0: curve_list_mag.append(Segment(Z2s, Z3s)) curve_list_mag.append(Segment(Z3s, Z4s)) if self.H3 > 0: curve_list_mag.append(Segment(Z4s, Z5s)) if self.W2 > 0: curve_list_mag.append(Segment(Z5s, Z6s)) curve_list_mag.append(Segment(Z6s, Z6)) if self.W2 > 0: curve_list_mag.append(Segment(Z6, Z5)) curve_list_mag.append(Segment(Z5, Z9)) if self.W2 > 0: curve_list_mag.append(Segment(Z9, Z8)) curve_list_mag.append(Segment(Z8s, Z11s)) curve_list_air.append(Arc1(Z11s, Z1s, -Rbo + self.H1)) point_ref = (Z3s + Z4s + Z9s + Z10s) / 4 S10 = SurfLine(line_list=curve_list_mag, label="Hole" + st, point_ref=point_ref) # No magnet_0 and W1 = 0 curve_list_mag = list() curve_list_mag.append(Segment(Z1, Z2)) if self.H3 > 0: curve_list_mag.append(Segment(Z2, Z3)) curve_list_mag.append(Segment(Z3, Z4)) if self.H3 > 0: curve_list_mag.append(Segment(Z4, Z5)) if self.W2 > 0: curve_list_mag.append(Segment(Z5, Z6)) curve_list_mag.append(Segment(Z6, Z6s)) if self.W2 > 0: curve_list_mag.append(Segment(Z6s, Z5s)) curve_list_mag.append(Segment(Z5s, Z9s)) if self.W2 > 0: curve_list_mag.append(Segment(Z9s, Z8s)) curve_list_mag.append(Segment(Z8, Z11)) curve_list_air.append(Arc1(Z11, Z1, -Rbo + self.H1)) point_ref = (Z3 + Z4 + Z9 + Z10) / 4 S11 = SurfLine(line_list=curve_list_mag, label="Hole" + st, point_ref=point_ref) # No magnet and W1 = 0 curve_list_mag = list() curve_list_air.append(Arc1(Z1, Z11, Rbo - self.H1)) curve_list_mag.append(Segment(Z11, Z8)) curve_list_mag.append(Segment(Z8, Z11s)) curve_list_air.append(Arc1(Z11s, Z1s, Rbo - self.H1)) curve_list_mag.append(Segment(Z1s, Z2s)) if self.H3 > 0: curve_list_mag.append(Segment(Z2s, Z3s)) curve_list_mag.append(Segment(Z3s, Z4s)) if self.H3 > 0: curve_list_mag.append(Segment(Z4s, Z5s)) if self.W2 > 0: curve_list_mag.append(Segment(Z5s, Z6s)) curve_list_mag.append(Segment(Z6s, Z6)) if self.W2 > 0: curve_list_mag.append(Segment(Z6, Z5)) if self.H3 > 0: curve_list_mag.append(Segment(Z5, Z4)) curve_list_mag.append(Segment(Z4, Z3)) if self.H3 > 0: curve_list_mag.append(Segment(Z3, Z2)) curve_list_mag.append(Segment(Z2, Z1)) point_ref = (Z6 + Z8 + Z6s) / 3 S12 = SurfLine(line_list=curve_list_mag, label="Hole" + st, point_ref=point_ref) # Create the surface list by selecting the correct ones if self.magnet_0 and self.magnet_1 and self.W1 > 0: S1.label = S1.label + "_R0_T0_S0" # Hole S3.label = S3.label + "_R0_T1_S0" # Hole S6.label = S6.label + "_R0_T2_S0" # Hole S4.label = S4.label + "_R0_T3_S0" # Hole surf_list = [S1, S2, S3, S6, S5, S4] elif self.magnet_0 and self.magnet_1 and self.W1 == 0: S1.label = S1.label + "_R0_T0_S0" # Hole S7.label = S7.label + "_R0_T1_S0" # Hole S4.label = S4.label + "_R0_T2_S0" # Hole surf_list = [S1, S2, S7, S5, S4] elif self.magnet_0 and not self.magnet_1 and self.W1 > 0: S1.label = S1.label + "_R0_T0_S0" # Hole S3.label = S3.label + "_R0_T1_S0" # Hole S9.label = S9.label + "_R0_T2_S0" # Hole surf_list = [S1, S2, S3, S9] elif self.magnet_0 and not self.magnet_1 and self.W1 == 0: S1.label = S1.label + "_R0_T0_S0" # Hole S10.label = S10.label + "_R0_T1_S0" # Hole surf_list = [S1, S2, S10] elif not self.magnet_0 and self.magnet_1 and self.W1 > 0: S8.label = S8.label + "_R0_T0_S0" # Hole S6.label = S6.label + "_R0_T1_S0" # Hole S4.label = S4.label + "_R0_T2_S0" # Hole surf_list = [S8, S6, S5, S4] elif not self.magnet_0 and self.magnet_1 and self.W1 == 0: S11.label = S11.label + "_R0_T0_S0" # Hole S4.label = S4.label + "_R0_T2_S0" # Hole surf_list = [S11, S5, S4] elif not self.magnet_0 and not self.magnet_1 and self.W1 > 0: S8.label = S8.label + "_R0_T0_S0" # Hole S9.label = S9.label + "_R0_T1_S0" # Hole surf_list = [S8, S9] elif not self.magnet_0 and not self.magnet_1 and self.W1 == 0: S12.label = S12.label + "_R0_T0_S0" # Hole surf_list = [S12] # Apply the transformation for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry(self, alpha=0, delta=0, is_simplified=False): """Compute the curve (Line) needed to plot the Hole. The ending point of a curve is the starting point of the next curve in the list Parameters ---------- self : HoleM51 A HoleM51 object alpha : float Angle to rotate the hole (Default value = 0) [rad] delta : complex Complex to translate the hole (Default value = 0) is_simplified : bool True to avoid line superposition Returns ------- surf_list: list List of SurfLine needed to draw the HoleM51 """ if self.get_is_stator(): # check if the slot is on the stator st = "_Stator" else: st = "_Rotor" Rbo = self.get_Rbo() # comp point coordinate (in complex) alpha = self.comp_alpha() Wslot = 2 * sin(self.W1 / 2) * (Rbo - self.H1) L = 0.5 * (Wslot - self.W0) / cos(alpha) # ||P2,P5|| # Center of the hole Z0 = Rbo - self.H0 Z2 = Z0 + 1j * self.W0 / 2 Z25 = Z0 - 1j * self.W0 / 2 Z15 = Z25 - self.H2 Z1 = Z2 - 1j * self.W2 Z26 = Z1 - 1j * self.W3 Z12 = Z2 - self.H2 Z13 = Z12 - 1j * self.W2 Z14 = Z13 - 1j * self.W3 Z11 = Z12 + 1j * tan(alpha / 2) * self.H2 Z16 = Z15 - 1j * tan(alpha / 2) * self.H2 # Draw the left side with center P2, and X axis =(P2,P5), Y axis=(P2,P10) Z3 = self.W4 * exp(1j * (pi / 2 - alpha)) + Z2 Z4 = (self.W4 + self.W5) * exp(1j * (pi / 2 - alpha)) + Z2 Z5 = (Rbo - self.H1) * exp(1j * self.W1 / 2) Z10 = (1j * self.H2) * exp(1j * (pi / 2 - alpha)) + Z2 Z9 = (1j * self.H2 + self.W4) * exp(1j * (pi / 2 - alpha)) + Z2 Z8 = (1j * self.H2 + self.W4 + self.W5) * exp(1j * (pi / 2 - alpha)) + Z2 Z7 = (1j * self.H2 + L) * exp(1j * (pi / 2 - alpha)) + Z2 # Draw the right side with center P25, X axis (P25,P23), Y axis(P25,P17) Z24 = self.W6 * exp(-1j * (pi / 2 - alpha)) + Z25 Z23 = (self.W6 + self.W7) * exp(-1j * (pi / 2 - alpha)) + Z25 Z22 = (Rbo - self.H1) * exp(-1j * self.W1 / 2) Z17 = (1j * self.H2) * exp(-1j * (pi / 2 - alpha)) + Z25 Z18 = (-1j * self.H2 + self.W6) * exp(-1j * (pi / 2 - alpha)) + Z25 Z19 = (-1j * self.H2 + self.W6 + self.W7) * exp(-1j * (pi / 2 - alpha)) + Z25 Z20 = (-1j * self.H2 + L) * exp(-1j * (pi / 2 - alpha)) + Z25 # Z6 is the intersection of the line [Z7,Z10] and Circle centre # (0,0) radius Rbo - H1 Zint = inter_line_circle(Z7, Z10, Rbo - self.H1) # Select the point with Re(Z) > 0 if Zint[0].real > 0: Z6 = Zint[0] else: Z6 = Zint[1] Z21 = Z6.conjugate() surf_list = list() # Create all the surfaces for all the cases # Air surface bore around magnet_0 curve_list = list() curve_list.append(Arc1(Z21, Z22, Rbo - self.H1)) curve_list.append(Segment(Z22, Z23)) curve_list.append(Segment(Z23, Z19)) curve_list.append(Segment(Z19, Z21)) point_ref = (Z21 + Z22 + Z23 + Z19) / 4 S1 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Surface for magnet_0 curve_list = list() if is_simplified: curve_list.append(Segment(Z24, Z18)) curve_list.append(Segment(Z19, Z23)) else: curve_list.append(Segment(Z24, Z18)) curve_list.append(Segment(Z18, Z19)) curve_list.append(Segment(Z19, Z23)) curve_list.append(Segment(Z23, Z24)) point_ref = (Z24 + Z18 + Z19 + Z23) / 4 # Defining type of magnetization of the magnet if self.magnet_0: if self.magnet_0.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T0_S0" S2 = SurfLine(line_list=curve_list, label=magnet_label, point_ref=point_ref) # Air surface between magnet_0 and magnet_1 curve_list = list() curve_list.append(Segment(Z24, Z25)) curve_list.append(Segment(Z25, Z26)) curve_list.append(Segment(Z26, Z14)) curve_list.append(Segment(Z14, Z16)) curve_list.append(Segment(Z16, Z18)) curve_list.append(Segment(Z18, Z24)) point_ref = (Z25 + Z16) / 2 S3 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Surface for magnet_1 curve_list = list() if is_simplified: curve_list.append(Segment(Z1, Z13)) curve_list.append(Segment(Z14, Z26)) else: curve_list.append(Segment(Z26, Z1)) curve_list.append(Segment(Z1, Z13)) curve_list.append(Segment(Z13, Z14)) curve_list.append(Segment(Z14, Z26)) point_ref = (Z26 + Z1 + Z13 + Z14) / 4 # Defining type of magnetization of the magnet if self.magnet_1: if self.magnet_1.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T1_S0" S4 = SurfLine(line_list=curve_list, label=magnet_label, point_ref=point_ref) # Air surface between magnet_1 and magnet_2 curve_list = list() curve_list.append(Segment(Z1, Z2)) curve_list.append(Segment(Z2, Z3)) curve_list.append(Segment(Z3, Z9)) curve_list.append(Segment(Z9, Z11)) curve_list.append(Segment(Z11, Z13)) curve_list.append(Segment(Z13, Z1)) point_ref = (Z11 + Z2) / 2 S5 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Surface for magnet_2 curve_list = list() if is_simplified: curve_list.append(Segment(Z4, Z8)) curve_list.append(Segment(Z9, Z3)) else: curve_list.append(Segment(Z4, Z8)) curve_list.append(Segment(Z8, Z9)) curve_list.append(Segment(Z9, Z3)) curve_list.append(Segment(Z3, Z4)) point_ref = (Z4 + Z8 + Z9 + Z3) / 4 # Defining type of magnetization of the magnet if self.magnet_2: if self.magnet_2.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T2_S0" S6 = SurfLine(line_list=curve_list, label=magnet_label, point_ref=point_ref) # Air surface bore around magnet_2 curve_list = list() curve_list.append(Arc1(Z5, Z6, Rbo - self.H1)) curve_list.append(Segment(Z6, Z8)) curve_list.append(Segment(Z8, Z4)) curve_list.append(Segment(Z4, Z5)) point_ref = (Z4 + Z5 + Z6 + Z8) / 4 S7 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Air surface bore around magnet_2 (no magnet_2 and magnet_1) curve_list = list() curve_list.append(Arc1(Z5, Z6, Rbo - self.H1)) curve_list.append(Segment(Z6, Z11)) curve_list.append(Segment(Z11, Z13)) curve_list.append(Segment(Z13, Z1)) curve_list.append(Segment(Z1, Z2)) curve_list.append(Segment(Z2, Z5)) point_ref = (Z2 + Z11) / 2 S8 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Air surface bore around magnet_0 (no magnet_0 and magnet_1) curve_list = list() curve_list.append(Arc1(Z21, Z22, Rbo - self.H1)) curve_list.append(Segment(Z22, Z25)) curve_list.append(Segment(Z25, Z26)) curve_list.append(Segment(Z26, Z14)) curve_list.append(Segment(Z14, Z16)) curve_list.append(Segment(Z16, Z21)) point_ref = (Z25 + Z16) / 2 S9 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Air surface bore around magnet_1 (no magnet_1 and magnet_0 and magnet_2) curve_list = list() curve_list.append(Segment(Z24, Z25)) curve_list.append(Segment(Z25, Z2)) curve_list.append(Segment(Z2, Z3)) curve_list.append(Segment(Z3, Z9)) curve_list.append(Segment(Z9, Z11)) curve_list.append(Segment(Z11, Z16)) curve_list.append(Segment(Z16, Z18)) curve_list.append(Segment(Z18, Z24)) point_ref = (Z1 + Z13) / 2 S10 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Air surface bore around magnet_1 (no magnet_1 and no magnet_0 and magnet_2) curve_list = list() curve_list.append(Arc1(Z21, Z22, Rbo - self.H1)) curve_list.append(Segment(Z22, Z25)) curve_list.append(Segment(Z25, Z2)) curve_list.append(Segment(Z2, Z3)) curve_list.append(Segment(Z3, Z9)) curve_list.append(Segment(Z9, Z11)) curve_list.append(Segment(Z11, Z16)) curve_list.append(Segment(Z16, Z21)) point_ref = (Z1 + Z13) / 2 S11 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Air surface bore around magnet_1 (no magnet_1 and magnet_0 and no magnet_2) curve_list = list() curve_list.append(Arc1(Z5, Z6, Rbo - self.H1)) curve_list.append(Segment(Z6, Z11)) curve_list.append(Segment(Z11, Z16)) curve_list.append(Segment(Z16, Z18)) curve_list.append(Segment(Z18, Z24)) curve_list.append(Segment(Z24, Z25)) curve_list.append(Segment(Z25, Z2)) curve_list.append(Segment(Z2, Z5)) point_ref = (Z1 + Z13) / 2 S12 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Air surface No magnet curve_list = list() curve_list.append(Arc1(Z5, Z6, Rbo - self.H1)) curve_list.append(Segment(Z6, Z11)) curve_list.append(Segment(Z11, Z16)) curve_list.append(Segment(Z16, Z21)) curve_list.append(Arc1(Z21, Z22, Rbo - self.H1)) curve_list.append(Segment(Z22, Z25)) curve_list.append(Segment(Z25, Z2)) curve_list.append(Segment(Z2, Z5)) point_ref = (Z1 + Z13) / 2 S13 = SurfLine(line_list=curve_list, label="Hole" + st, point_ref=point_ref) # Create the surface list by selecting the correct ones if self.magnet_0 and self.magnet_1 and self.magnet_2: S1.label = S1.label + "_R0_T0_S0" # Hole S3.label = S3.label + "_R0_T1_S0" # Hole S5.label = S5.label + "_R0_T2_S0" # Hole S7.label = S7.label + "_R0_T3_S0" # Hole surf_list = [S1, S2, S3, S4, S5, S6, S7] elif not self.magnet_0 and self.magnet_1 and self.magnet_2: S9.label = S9.label + "_R0_T0_S0" # Hole S5.label = S5.label + "_R0_T1_S0" # Hole S7.label = S7.label + "_R0_T2_S0" # Hole surf_list = [S9, S4, S5, S6, S7] elif self.magnet_0 and not self.magnet_1 and self.magnet_2: S1.label = S1.label + "_R0_T0_S0" # Hole S10.label = S10.label + "_R0_T1_S0" # Hole S7.label = S7.label + "_R0_T2_S0" # Hole surf_list = [S1, S2, S10, S6, S7] elif not self.magnet_0 and not self.magnet_1 and self.magnet_2: S11.label = S11.label + "_R0_T0_S0" # Hole S7.label = S7.label + "_R0_T1_S0" # Hole surf_list = [S11, S6, S7] elif self.magnet_0 and self.magnet_1 and not self.magnet_2: S1.label = S1.label + "_R0_T0_S0" # Hole S3.label = S3.label + "_R0_T1_S0" # Hole S8.label = S8.label + "_R0_T2_S0" # Hole surf_list = [S1, S2, S3, S4, S8] elif not self.magnet_0 and self.magnet_1 and not self.magnet_2: S9.label = S9.label + "_R0_T0_S0" # Hole S8.label = S8.label + "_R0_T1_S0" # Hole surf_list = [S9, S4, S8] elif self.magnet_0 and not self.magnet_1 and not self.magnet_2: S1.label = S1.label + "_R0_T0_S0" # Hole S12.label = S12.label + "_R0_T1_S0" # Hole surf_list = [S1, S2, S12] elif not self.magnet_0 and not self.magnet_1 and not self.magnet_2: S13.label = S13.label + "_R0_T0_S0" # Hole surf_list = [S13] for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry(self, alpha=0, delta=0, is_simplified=False): """Compute the curve (Line) needed to plot the Slot. The ending point of a curve is the starting point of the next curve in the list Parameters ---------- self : HoleMLSRPM A HoleMLSRPM object alpha : float Angle to rotate the slot (Default value = 0) [rad] delta : complex Complex to translate the slot (Default value = 0) is_simplified : bool True to avoid line superposition Returns ------- surf_list: list List of SurfLine needed to draw the HoleM51 """ if self.get_is_stator(): # check if the slot is on the stator st = "_Stator" else: st = "_Rotor" Rbo = self.get_Rbo() # Z1 delta1 = arcsin((self.R1 + self.W2) / (self.R1 + self.R3)) alpha1 = self.W1 - delta1 Z1 = self.R3 * exp(-1j * alpha1) # Zc1 Zc1 = (self.R3 + self.R1) * exp(-1j * alpha1) xc1 = (self.R3 + self.R1) * cos(alpha1) yc1 = -(self.R3 + self.R1) * sin(alpha1) # Z2 x2 = (-1 / tan(self.W1) * xc1 + yc1 - self.W2 / cos(self.W1)) / -(tan(self.W1) + 1 / tan(self.W1)) y2 = -tan(self.W1) * x2 + self.W2 / cos(self.W1) Z2 = x2 + 1j * y2 # Z3 a3 = 1 + tan(self.W1)**2 b3 = -2 * tan(self.W1) * self.W2 / cos(self.W1) c3 = (self.W2 / cos(self.W1))**2 - self.R2**2 x3 = (-b3 + sqrt(b3**2 - 4 * a3 * c3)) / (2 * a3) y3 = -tan(self.W1) * x3 + self.W2 / cos(self.W1) Z3 = x3 + 1j * y3 # Z5 x5 = Rbo - self.H1 y5 = -self.W0 / 2 Z5 = x5 + 1j * y5 # Zc2 xc2 = Rbo - self.H1 - self.R1 yc2 = -self.W0 / 2 Zc2 = xc2 + 1j * yc2 # Z4 a4 = (xc2 - x3)**2 - self.R1**2 b4 = 2 * (xc2 - x3) * (y3 - yc2) c4 = (y3 - yc2)**2 - self.R1**2 alpha2 = (-b4 - sqrt(b4**2 - 4 * a4 * c4)) / (2 * a4) x4 = (xc2 / alpha2 + yc2 + alpha2 * x3 - y3) / (alpha2 + 1 / alpha2) y4 = alpha2 * (x4 - x3) + y3 Z4 = x4 + 1j * y4 # symmetry Z6 = Z5.conjugate() Z7 = Z4.conjugate() Z8 = Z3.conjugate() Z9 = Z2.conjugate() Z10 = Z1.conjugate() # Creation of the magnet curve curve_list_mag = list() curve_list_mag.append(Segment(Z3, Z4)) curve_list_mag.append(Segment(Z4, Z7)) curve_list_mag.append(Segment(Z7, Z8)) curve_list_mag.append(Segment(Z8, Z3)) point_ref = (Z3 + Z4 + Z7 + Z8) / 4 # curve_list_mag = list() # curve_list_mag.append( # Arc1(begin=Z1, end=Z2, radius=self.R1, is_trigo_direction=True) # ) # curve_list_mag.append(Segment(Z2, Z3)) # curve_list_mag.append(Segment(Z3, Z4)) # curve_list_mag.append( # Arc1(begin=Z4, end=Z5, radius=self.R1, is_trigo_direction=True) # ) # curve_list_mag.append(Segment(Z5, Z6)) # curve_list_mag.append( # Arc1(begin=Z6, end=Z7, radius=self.R1, is_trigo_direction=True) # ) # curve_list_mag.append(Segment(Z7, Z8)) # curve_list_mag.append(Segment(Z8, Z9)) # curve_list_mag.append( # Arc1(begin=Z9, end=Z10, radius=self.R1, is_trigo_direction=True) # ) # curve_list_mag.append( # Arc1(begin=Z10, end=Z1, radius=-self.R3, is_trigo_direction=False) # ) # point_ref = (Z1 + Z2 + Z3 + Z4 + Z5 + Z6 + Z7 + Z8 + Z9 + Z10) / 10 # Defining type of magnetization of the magnet if self.magnet_0: if self.magnet_0.type_magnetization == 0: type_mag = "_Radial" else: type_mag = "_Parallel" else: type_mag = "None" magnet_label = "HoleMagnet" + st + type_mag + "_N_R0_T0_S0" # if self.magnet_0: # S1 = SurfLine(line_list=curve_list_mag, label=magnet_label, point_ref=point_ref) # else: # S1 = SurfLine(line_list=curve_list_mag, label="Hole", point_ref=point_ref) # surf_list = [S1] S1 = SurfLine(line_list=curve_list_mag, label=magnet_label, point_ref=point_ref) # Creation of the air curve (bottom) curve_list_air = list() curve_list_air.append( Arc1(begin=Z1, end=Z2, radius=self.R1, is_trigo_direction=True)) curve_list_air.append(Segment(Z2, Z3)) curve_list_air.append(Segment(Z3, Z8)) curve_list_air.append(Segment(Z8, Z9)) curve_list_air.append( Arc1(begin=Z9, end=Z10, radius=self.R1, is_trigo_direction=True)) curve_list_air.append( Arc1(begin=Z10, end=Z1, radius=-self.R3, is_trigo_direction=False)) point_ref = (Z1 + Z2 + Z3 + Z8 + Z9 + Z10) / 6 S2 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Creation of the second air curve (top) curve_list_air = list() curve_list_air.append( Arc1(begin=Z4, end=Z5, radius=self.R1, is_trigo_direction=True)) curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append( Arc1(begin=Z6, end=Z7, radius=self.R1, is_trigo_direction=True)) curve_list_air.append(Segment(Z7, Z4)) point_ref = (Z4 + Z5 + Z6 + Z7) / 4 S3 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) # Air without magnet (S4=S1+S2+S3) curve_list_air = list() curve_list_air.append( Arc1(begin=Z1, end=Z2, radius=self.R1, is_trigo_direction=True)) curve_list_air.append(Segment(Z2, Z3)) curve_list_air.append(Segment(Z3, Z4)) curve_list_air.append( Arc1(begin=Z4, end=Z5, radius=self.R1, is_trigo_direction=True)) curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append( Arc1(begin=Z6, end=Z7, radius=self.R1, is_trigo_direction=True)) curve_list_air.append(Segment(Z7, Z8)) curve_list_air.append(Segment(Z8, Z9)) curve_list_air.append( Arc1(begin=Z9, end=Z10, radius=self.R1, is_trigo_direction=True)) curve_list_air.append( Arc1(begin=Z10, end=Z1, radius=-self.R3, is_trigo_direction=False)) point_ref = (Z1 + Z2 + Z3 + Z4 + Z5 + Z6 + Z7 + Z8 + Z9 + Z10) / 10 S4 = SurfLine(line_list=curve_list_air, label="Hole" + st, point_ref=point_ref) if self.magnet_0: S2.label = S2.label + "_R0_T0_S0" # Hole S3.label = S3.label + "_R0_T1_S0" # Hole surf_list = [S1, S2, S3] else: S4.label = S4.label + "_R0_T0_S0" # Hole surf_list = [S4] # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list