def get_airgap_surface(lam_int, lam_ext): """Returns a list of surface in the airgap without sliding band surface Parameters ---------- lam_int: Internal lamination lam_ext: External lamination Returns ------- surf_list: list List of surface in the airgap including the sliding band surface """ Rgap_mec_int = lam_int.comp_radius_mec() Rgap_mec_ext = lam_ext.comp_radius_mec() Wgap_mec = Rgap_mec_ext - Rgap_mec_int W_sb = Wgap_mec / 3 # Width sliding band surf_list = list() # Middle surf_list.append( SurfLine( line_list=[], point_ref=(Rgap_mec_int + W_sb * 3 / 2) * exp(1j * pi / 2), label="Airgap", )) return surf_list
def gen_curve_list(point_list, RX, TY, st): """ Parameters ---------- point_list : RX : TY : st : Returns ------- """ curve_list = list() for ii in range(len(point_list) - 1): curve_list.append(Segment(point_list[ii], point_list[ii + 1])) curve_list.append(Segment(point_list[-1], point_list[0])) res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R" + RX + "_T" + TY + "_S0", point_ref=point_ref, ) return surface
def build_geometry(self, alpha=0, delta=0, is_simplified=False): """Compute the curve (Arc) needed to plot the Hole. The ending point of a curve is the starting point of the next curve in the list Parameters ---------- self : HoleM54 A HoleM54 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 Air Surface on the slot """ Rbo = self.get_Rbo() # Compute point coordinates Zc0 = Rbo - self.H0 + self.R1 Z1 = (self.R1 * exp(1j * (-pi + self.W0 / 2))) + Zc0 Z2 = (self.R1 * exp(1j * (pi - self.W0 / 2))) + Zc0 Z4 = ((self.R1 + self.H1) * exp(1j * (-pi + self.W0 / 2))) + Zc0 Z3 = ((self.R1 + self.H1) * exp(1j * (pi - self.W0 / 2))) + Zc0 Zref = Rbo - self.H0 - self.H1 / 2 surf_list = list() curve_list = list() curve_list.append(Arc1(begin=Z1, end=Z2, radius=-self.R1, is_trigo_direction=False)) curve_list.append(Arc3(begin=Z2, end=Z3, is_trigo_direction=True)) curve_list.append(Arc1(begin=Z3, end=Z4, radius=self.R1 + self.H1)) curve_list.append(Arc3(begin=Z4, end=Z1, is_trigo_direction=True)) if self.get_is_stator(): # check if the slot is on the stator st = "_Stator" else: st = "_Rotor" surf_list.append( SurfLine(line_list=curve_list, label="Hole" + st + "_R0_T0_S0", point_ref=Zref) ) # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def test_translate(self): """Check that you can rotate the surface """ line1 = Arc1(begin=1, end=1j, radius=1) line2 = Arc2(begin=1, center=0, angle=pi / 2) line3 = Segment(begin=1j, end=0) surface = SurfLine(line_list=[line1, line2, line3], label="test", point_ref=0) surface.translate(1j) self.assertAlmostEqual(abs(line1.begin - 1j), 1) self.assertAlmostEqual(line1.end, 2j) self.assertAlmostEqual(abs(line2.begin - 1j), 1) self.assertAlmostEqual(abs(line2.center - 1j), 0) self.assertAlmostEqual(abs(line3.begin - 2j), 0) self.assertAlmostEqual(line3.end, 1j)
def get_surface_tooth(self): """Returns the surface delimiting the tooth (including yoke part) Parameters ---------- self : Slot A Slot object Returns ------- surface: SurfLine A SurfLine object representing the slot """ if self.parent is not None: Ryoke = self.parent.get_Ryoke() else: raise ParentMissingError("Error: The slot is not inside a Lamination") curve_list = list() # tooth lines top_list = self.build_geometry_half_tooth(is_top=True) bot_list = self.build_geometry_half_tooth(is_top=False) # Yoke lines Z1 = Ryoke * exp(1j * pi / self.Zs) Z2 = Ryoke * exp(-1j * pi / self.Zs) curve_list.append( Segment(top_list[-1].get_end(), Z1, label="Tooth_Yoke_Side")) if Ryoke > 0: curve_list.append( Arc1( begin=Z1, end=Z2, radius=-Ryoke, is_trigo_direction=False, label="Tooth_Yoke_Arc", )) curve_list.append( Segment(Z2, bot_list[0].get_begin(), label="Tooth_Yoke_Side")) # Second half of the tooth curve_list.extend(bot_list) curve_list.extend(top_list) return SurfLine(line_list=curve_list, label="Tooth")
def test_comp_length(self): """Check that you can compute the length of the Surface """ line1 = Arc1(begin=1, end=1j, radius=1) line1.comp_length = MagicMock(return_value=1) line2 = Arc2(begin=1, center=0, angle=pi / 2) line2.comp_length = MagicMock(return_value=1) line3 = Segment(begin=1j, end=0) line3.comp_length = MagicMock(return_value=1) surface = SurfLine(line_list=[line1, line2, line3], label="test", point_ref=0) length = surface.comp_length() line1.comp_length.assert_called_once() line2.comp_length.assert_called_once() line3.comp_length.assert_called_once() self.assertAlmostEqual(abs(length - 3), 0)
def build_geometry(self, sym=1, alpha=0, delta=0): """Build the geometry of the shaft Parameters ---------- self : Shaft Shaft Object sym : int Symmetry factor (1= full machine, 2= half of the machine...) alpha : float Angle for rotation [rad] delta : complex Complex value for translation Returns ------- surf_list : list list of surfaces needed to draw the lamination """ surf_list = list() if sym == 1: surf_list.append( Circle(radius=self.Drsh / 2, label="Shaft", center=0, point_ref=0)) else: begin = self.Drsh / 2 end = begin * exp(1j * 2 * pi / sym) surface = SurfLine( line_list=[ Segment(0, begin), Arc1(begin, end, self.Drsh / 2), Segment(end, 0), ], label="Shaft", point_ref=0, ) surf_list.append(surface) for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def get_surface(self): """Returns the surface delimiting the slot Parameters ---------- self : Slot A Slot object Returns ------- surface: SurfLine A SurfLine object representing the slot """ Rbo = self.get_Rbo() curve_list = self.build_geometry() Zbegin = curve_list[-1].get_end() Zend = curve_list[0].get_begin() curve_list.append(Arc1(Zbegin, Zend, -Rbo)) return SurfLine(line_list=curve_list, label="Slot")
def build_geometry(self, sym=1, alpha=0, delta=0): """Build the geometry of the Lamination Parameters ---------- self : Lamination Lamination Object sym : int Symmetry factor (1= full machine, 2= half of the machine...) alpha : float Angle for rotation [rad] delta : complex Complex value for translation Returns surf_list : list list of surfaces needed to draw the lamination """ # Lamination label if self.is_stator: label = "Lamination_Stator" else: label = "Lamination_Rotor" if self.is_internal: ls = "_Bore_" # label for the bore ly = "_Yoke_" # label for the yoke else: ls = "_Yoke_" ly = "_Bore_" surf_list = list() if sym == 1: # Complete lamination surface_yoke = Circle( radius=self.Rext, label=label + ly + "Ext", center=0, point_ref=self.Rint + (self.Rext - self.Rint) / 2, ) surf_list.append(surface_yoke) if self.Rint > 0: surface = Circle(radius=self.Rint, label=label + ls + "Int", center=0, point_ref=0) surf_list.append(surface) else: # Part of the lamination by symmetry Z0 = self.Rint Z1 = self.Rext Z3 = Z0 * exp(1j * 2 * pi / sym) Z2 = Z1 * exp(1j * 2 * pi / sym) curve_list = list() curve_list.append(Segment(Z0, Z1)) curve_list.append( Arc1(begin=Z1, end=Z2, radius=self.Rext, is_trigo_direction=True)) curve_list.append(Segment(Z2, Z3)) if self.Rint > 0: curve_list.append( Arc1(begin=Z3, end=Z0, radius=self.Rint, is_trigo_direction=False)) surf_yoke = SurfLine( line_list=curve_list, label=label + "_Ext", point_ref=self.Rint + (self.Rext - self.Rint) / 2, ) surf_list.append(surf_yoke) # Add the ventilation ducts if there is any for vent in self.axial_vent: surf_list.extend(vent.build_geometry(sym=sym, is_stator=self.is_stator)) # apply the transformation for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW23 A SlotW23 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : Complex complex for translation (Default value = 0) Returns ------- surf_list: List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" [Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1] = self._comp_point_coordinate() X = linspace(Z6, Z5, Nrad + 1) # Nrad+1 and Ntan+1 because 3 points => 2 zones Z = zeros((Nrad + 1, Ntan + 1), dtype=complex) for ii in range(Nrad + 1): Z[ii][:] = linspace(X[ii], X[ii].conjugate(), Ntan + 1) # The bottom and top are Arc and not a line Z[0][:] = abs(Z6) * exp(1j * linspace(angle(Z6), angle(Z3), Ntan + 1)) Z[Nrad][:] = abs(Z5) * exp(1j * linspace(angle(Z5), angle(Z4), Ntan + 1)) assert abs(Z[0][0] - Z6) < 1e-6 assert abs(Z[Nrad][0] - Z5) < 1e-6 assert abs(Z[0][Ntan] - Z3) < 1e-6 assert abs(Z[Nrad][Ntan] - Z4) < 1e-6 Zc = 0 # Center of the machine # We go thought the zone by Rad then Tan, starting by (0,0) surf_list = list() for jj in range(Ntan): # jj from 0 to Ntan-1 for ii in range(Nrad): # ii from 0 to Nrad-1 Z1 = Z[ii][jj] Z2 = Z[ii][jj + 1] Z3 = Z[ii + 1][jj + 1] Z4 = Z[ii + 1][jj] point_ref = (Z1 + Z2 + Z3 + Z4) / 4 # With one zone the order would be [Z6,Z3,Z4,Z5] if is_simplified: # No doubling Line allowed curve_list = list() if ii == 0: curve_list.append(Segment(Z1, Z2)) if jj != Ntan - 1: curve_list.append(Segment(Z2, Z3)) if ii != Nrad - 1: curve_list.append(Segment(Z3, Z4)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R" + str(ii) + "_T" + str(jj) + "_S0", point_ref=point_ref, ) surf_list.append(surface) else: curve_list = list() curve_list.append(Segment(Z1, Z2)) curve_list.append(Segment(Z2, Z3)) if ii == Nrad - 1: # Top zone curve_list.append(Arc2(Z3, Zc, angle(Z4) - angle(Z3))) else: curve_list.append(Segment(Z3, Z4)) curve_list.append(Segment(Z4, Z1)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R" + str(ii) + "_T" + str(jj) + "_S0", point_ref=point_ref, ) surf_list.append(surface) for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry(self, sym=1, alpha=0, delta=0, is_simplified=False): """Build the geometry of the LamHole object Parameters ---------- self : LamHole The LamHole to build in surface sym : int Symmetry factor (1= full machine, 2= half of the machine...) alpha : float Angle for rotation [rad] delta : complex Complex value for translation is_simplified: bool True to avoid line superposition Returns ------- surf_list : list list of surfaces needed to draw the lamination """ # Lamination label if self.is_stator: label = "Lamination_Stator_" else: label = "Lamination_Rotor_" ref_point = (self.Rint + (self.Rext - self.Rint) / 2) * exp(1j * pi / sym) surf_list = list() # Lamination surface(s) if sym == 1: # Complete lamination surf_list.append( Circle(radius=self.Rext, label=label + "Ext", point_ref=ref_point, center=0) ) if self.Rint > 0: surf_list.append( Circle(radius=self.Rint, label=label + "Int", point_ref=0, center=0) ) else: # Symmetry lamination begin = self.Rext end = self.Rext * exp(1j * 2 * pi / sym) Z_begin = self.Rint Z_end = self.Rint * exp(1j * 2 * pi / sym) line_list = [ Segment(Z_begin, begin), Arc1(begin, end, self.Rext), Segment(end, Z_end), ] if self.Rint > 0: line_list.append(Arc1(Z_end, Z_begin, -self.Rint)) surf_list.append( SurfLine(line_list=line_list, label=label + "Ext", point_ref=ref_point) ) # Holes surface(s) for hole in self.hole: Zh = hole.Zh assert (Zh % sym) == 0 # For now only angle = 2 * pi / Zh # Create the first hole surface(s) surf_hole = hole.build_geometry(alpha=pi / Zh) # Copy the hole for Zh / sym for ii in range(Zh // sym): for surf in surf_hole: new_surf = type(surf)(init_dict=surf.as_dict()) # changing the hole reference number new_surf.label = new_surf.label[:-1] + str(ii) if "Magnet" in surf.label and ii % 2 != 0: # if the surf is Magnet # Changing the pole of the magnet new_surf.label = new_surf.label[:-10] + "S" + new_surf.label[-9:] new_surf.rotate(ii * angle) surf_list.append(new_surf) # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) # Adding the ventilation surfaces for vent in self.axial_vent: surf_list += vent.build_geometry( sym=sym, alpha=alpha, delta=delta, is_stator=self.is_stator ) return surf_list
def build_geometry(self, sym=1, alpha=0, delta=0): """Build the geometry of the LamSlot object Parameters ---------- self : LamSlot a LamSlot object sym : int Symmetry factor (1= full machine, 2= half of the machine...) alpha : float Angle for rotation [rad] delta : complex Complex value for translation Returns ------- surf_list : list list of surfaces needed to draw the lamination """ # getting Number of Slot Zs = self.slot.Zs # Check for symmetry assert (Zs % sym) == 0 if self.is_stator: ll = "Stator" # Label lamination else: ll = "Rotor" if self.is_internal: ls = "Ext" # label for the slot ly = "In" # label for the yoke else: ls = "In" ly = "Ext" Ryoke = self.get_Ryoke() slot_pitch = 2 * pi / Zs op_angle = self.slot.comp_angle_opening() t_angle = slot_pitch - op_angle H_yoke = self.comp_height_yoke() # getting the Lines that delimit one slot Slot_lines = self.slot.build_geometry() for line in Slot_lines: line.rotate(slot_pitch / 2) # getting the bore line bore_lines = self.get_bore_line(slot_pitch - t_angle / 2, slot_pitch + t_angle / 2) Slot_lines.extend(bore_lines) # Generate all the Bore lines line_list = list() for ii in range(Zs // sym): # Duplicate and rotate the slot + bore for each slot for line in Slot_lines: new_line = type(line)(init_dict=line.as_dict()) new_line.rotate(ii * slot_pitch) line_list.append(new_line) # Create the lamination surface(s) surf_list = list() if sym == 1: # Complete lamination # Create Slot surface surf_slot = SurfLine(line_list=line_list, label="Lamination_" + ll + "_bore_" + ls) if self.is_internal: surf_slot.point_ref = Ryoke + (H_yoke / 2) else: surf_slot.point_ref = Ryoke - (H_yoke / 2) # Create yoke circle surface if Ryoke > 0: surf_yoke = Circle( radius=Ryoke, label="Lamination_" + ll + "_yoke_" + ly, line_label=ll + "_Yoke_Radius", center=0, ) # The order matters when plotting if self.is_internal: surf_list.append(surf_slot) if Ryoke > 0: surf_list.append(surf_yoke) else: surf_yoke.point_ref = None # No need to set the surface surf_list.append(surf_yoke) surf_list.append(surf_slot) else: # Only one surface # Modify the bore radius if len(bore_lines) > 0: line_list.pop(-1) start_angle = angle(line_list[-1].get_end()) line_list.extend( self.get_bore_line(start_angle, start_angle + t_angle / 2, label="Bore_line")) line_list.insert( 0, self.get_bore_line(0, t_angle / 2, label="Bore_line")[0]) # Add the Yoke part Zy1 = Ryoke Zy2 = Ryoke * exp(1j * 2 * pi / sym) line_list.append( Segment(line_list[-1].get_end(), Zy2, label=ll + "_Yoke_side")) if Ryoke > 0: # For internal lamination line_list.append(Arc1(Zy2, Zy1, -Ryoke, ll + "_Yoke_Radius")) line_list.append( Segment(Zy1, line_list[0].get_begin(), label=ll + "_Yoke_side")) # Create a Surface for the slot if self.is_internal: point_ref = (Ryoke + H_yoke / 2) * exp(1j * pi / sym) else: point_ref = (Ryoke - H_yoke / 2) * exp(1j * pi / sym) surf_slot = SurfLine( line_list=line_list, label="Lamination_" + ll + "_bore_" + ls, point_ref=point_ref, ) surf_list.append(surf_slot) # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) # Adding the ventilation surfaces for vent in self.axial_vent: surf_list += vent.build_geometry(sym=sym, alpha=alpha, delta=delta, is_stator=self.is_stator) return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW61 A SlotW61 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if the coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : complex complex for translation (Default value = 0) Returns ------- surf_list: list List of surface delimiting the winding zone """ if Nrad != 1 or Ntan != 2: raise S61_WindError("Slot 61 can use only for winding with Nrad=1 " + "and Ntan 2") self.check() # check if the slot is on the stator for the label if self.get_is_stator(): st = "S" else: st = "R" [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, Z10] = self._comp_point_coordinate() # Compute the point in the tooth ref hsp = pi / self.Zs Z4t = Z4 * exp(1j * hsp) Z5t = Z5 * exp(1j * hsp) Zw1t = Z4t - self.H3 Zw2t = Z5t + self.H4 Zw3t = Zw2t + 1j * ((self.W1 - self.W2) / 2 - self.W3) Zw4t = Zw1t + 1j * ((self.W1 - self.W2) / 2 - self.W3) # Go back to slot ref Zw1 = Zw1t * exp(1j * -hsp) Zw2 = Zw2t * exp(1j * -hsp) Zw3 = Zw3t * exp(1j * -hsp) Zw4 = Zw4t * exp(1j * -hsp) Zw1s = Zw1.conjugate() Zw2s = Zw2.conjugate() Zw3s = Zw3.conjugate() Zw4s = Zw4.conjugate() Ref1 = (Zw1 + Zw2 + Zw3 + Zw4) / 4 Ref2 = (Zw1s + Zw2s + Zw3s + Zw4s) / 4 # Create the surfaces surf_list = list() wind1 = [Segment(Zw3, Zw4)] wind2 = [Segment(Zw3s, Zw4s)] if (is_simplified and self.W3 > 0) or not is_simplified: wind1.append(Segment(Zw4, Zw1)) wind2.append(Segment(Zw4s, Zw1s)) if not is_simplified: wind1.append(Segment(Zw1, Zw2)) wind2.append(Segment(Zw1s, Zw2s)) if (is_simplified and self.W4 > 0) or not is_simplified: wind1.append(Segment(Zw2, Zw3)) wind2.append(Segment(Zw2s, Zw3s)) surf_list.append( SurfLine(line_list=wind1, label="Wind" + st + "_R0_T0_S0", point_ref=Ref1)) surf_list.append( SurfLine(line_list=wind2, label="Wind" + st + "_R0_T1_S0", point_ref=Ref2)) # Rotate and translate the surfaces 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 = "S" else: st = "R" 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="Air", 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 S2 = SurfLine( line_list=curve_list, label="Magnet" + st + "_N_R0_T0_S0", 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="Air", 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 S4 = SurfLine( line_list=curve_list, label="Magnet" + st + "_N_R0_T1_S0", 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="Air", 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 S6 = SurfLine( line_list=curve_list, label="Magnet" + st + "_N_R0_T2_S0", 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="Air", 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="Air", 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="Air", 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="Air", 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="Air", 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="Air", 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="Air", 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: surf_list = [S1, S2, S3, S4, S5, S6, S7] elif not self.magnet_0 and self.magnet_1 and self.magnet_2: surf_list = [S9, S4, S5, S6, S7] elif self.magnet_0 and not self.magnet_1 and self.magnet_2: surf_list = [S1, S2, S10, S6, S7] elif not self.magnet_0 and not self.magnet_1 and self.magnet_2: surf_list = [S11, S6, S7] elif self.magnet_0 and self.magnet_1 and not self.magnet_2: surf_list = [S1, S2, S3, S4, S8] elif not self.magnet_0 and self.magnet_1 and not self.magnet_2: surf_list = [S9, S4, S8] elif self.magnet_0 and not self.magnet_1 and not self.magnet_2: surf_list = [S1, S2, S12] elif not self.magnet_0 and not self.magnet_1 and not self.magnet_2: surf_list = [S13] for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW13 A SlotW13 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : Complex complex for translation (Default value = 0) Returns ------- surf_list: List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" [Z10, Z9, Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1] = self._comp_point_coordinate() X = linspace(Z7, Z6, Nrad + 1) # Nrad+1 and Ntan+1 because 3 points => 2 zones Z = zeros((Nrad + 1, Ntan + 1), dtype=complex) for ii in range(Nrad + 1): Z[ii][:] = linspace(X[ii], X[ii].conjugate(), Ntan + 1) assert Z[0][0] == Z7 assert Z[Nrad][0] == Z6 assert Z[0][Ntan] == Z4 assert Z[Nrad][Ntan] == Z5 # We go thought the surface by Rad then Tan, starting by (0,0) surf_list = list() for jj in range(Ntan): # jj from 0 to Ntan-1 for ii in range(Nrad): # ii from 0 to Nrad-1 point_ref = ( Z[ii][jj] + Z[ii][jj + 1] + Z[ii + 1][jj + 1] + Z[ii + 1][jj] ) / 4 # tre reference point of the surface # With one zone the order would be [Z7,Z4,Z5,Z6] if is_simplified: # No doubling Line allowed curve_list = list() if ii == 0: curve_list.append(Segment(Z[ii][jj], Z[ii][jj + 1])) if jj != Ntan - 1: curve_list.append(Segment(Z[ii][jj + 1], Z[ii + 1][jj + 1])) if ii != Nrad - 1: curve_list.append(Segment(Z[ii + 1][jj + 1], Z[ii + 1][jj])) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R" + str(ii) + "_T" + str(jj) + "_S0", point_ref=point_ref, ) # surface in the winding area surf_list.append(surface) else: curve_list = list() curve_list.append(Segment(Z[ii][jj], Z[ii][jj + 1])) curve_list.append(Segment(Z[ii][jj + 1], Z[ii + 1][jj + 1])) curve_list.append(Segment(Z[ii + 1][jj + 1], Z[ii + 1][jj])) curve_list.append(Segment(Z[ii + 1][jj], Z[ii][jj])) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R" + str(ii) + "_T" + str(jj) + "_S0", point_ref=point_ref, ) # surface in the winding area surf_list.append(surface) for surf in surf_list: surf.rotate(alpha) # rotation of each surface surf.translate(delta) # translation of each surface return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW12 A SlotW12 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : complex Complex for translation (Default value = 0) Returns ------- surf_list: list List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" Rbo = self.get_Rbo() # angle is the angle to rotate Z0 so ||Z1,Z8|| = 2*R2 angle = float(arcsin(self.R2 / Rbo)) # comp point coordinate (in complex) Z1 = Rbo * exp(1j * angle) if self.is_outwards(): Z3 = Z1 + self.H0 + self.R1 * 2 Z4 = Z3 + self.H1 Zrad1 = Z3.conjugate() + (self.H1 + self.R2) / 2.0 Ztan2 = Z4.real + self.R2 rot_sign = False else: # inward slot Z3 = Z1 - self.H0 - self.R1 * 2 Z4 = Z3 - self.H1 Zrad1 = Z3.conjugate() - (self.H1 + self.R2) / 2.0 Ztan2 = Z4.real - self.R2 rot_sign = True # symetry Z5 = Z4.conjugate() Z6 = Z3.conjugate() Zrad2 = Zrad1.conjugate() Ztan1 = Z3.real Zmid = (Ztan1 + Ztan2) / 2.0 surf_list = list() if (Nrad == 2 and Ntan == 1) and self.H1 > self.R2: if is_simplified: # no coincident lines allowed # Part 1 (0,0) line1 = Segment(Z6, Z3) line2 = Segment(Zrad2, Zrad1) point_ref = (Z6 + Z3 + Zrad2 + Zrad1) / 4 surface = SurfLine( line_list=[line1, line2], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) point_ref = (Z6 + Z3 + Zrad2 + Zrad1) / 4 surface = SurfLine(line_list=[], label="Wind" + st + "_R1_T0_S0", point_ref=point_ref) surf_list.append(surface) else: # Part 1 (0,0) line1 = Segment(Z6, Z3) line2 = Segment(Z3, Zrad2) line3 = Segment(Zrad2, Zrad1) line4 = Segment(Zrad1, Z6) point_ref = (Z6 + Z3 + Zrad2 + Zrad1) / 4 surface = SurfLine( line_list=[line1, line2, line3, line4], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) line1 = Segment(Zrad1, Zrad2) line2 = Segment(Zrad2, Z4) line3 = Arc3(Z4, Z5, rot_sign) line4 = Segment(Z5, Zrad1) point_ref = (Z4 + Z5 + Zrad2 + Zrad1) / 4 surface = SurfLine( line_list=[line1, line2, line3, line4], label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) elif Nrad == 1 and Ntan == 2: if is_simplified: # no coincident lines allowed # Part 1 (0,0) line1 = Segment(Z6, Ztan1) point_ref = (Z6 + Ztan1 + Ztan2 + Z5) / 4 surface = SurfLine(line_list=[line1], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref) surf_list.append(surface) # Part2 (0,1) line1 = Segment(Ztan1, Z3) point_ref = (Ztan1 + Z3 + Z4 + Ztan2) / 4 surface = SurfLine(line_list=[line1], label="Wind" + st + "_R0_T1_S0", point_ref=point_ref) surf_list.append(surface) else: # Part 1 (0,0) line1 = Segment(Z6, Ztan1) line2 = Segment(Ztan1, Ztan2) line3 = Arc1(Ztan2, Z5, self.R2) line4 = Segment(Z5, Z6) point_ref = (Z6 + Ztan1 + Ztan2 + Z5) / 4 surface = SurfLine( line_list=[line1, line2, line3, line4], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (0,1) line1 = Segment(Ztan1, Z3) line2 = Segment(Z3, Z4) line3 = Arc1(Z4, Ztan2, self.R2) line4 = Segment(Ztan2, Ztan1) point_ref = (Ztan1 + Z3 + Z4 + Ztan2) / 4 surface = SurfLine( line_list=[line1, line2, line3, line4], label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) elif Nrad == 2 and Ntan == 2 and self.H1 > self.R2: if is_simplified: # no coincident lines allowed # Part 1 (0,0) line1 = Segment(Z6, Ztan1) line2 = Segment(Ztan1, Zmid) line3 = Segment(Zmid, Zrad1) point_ref = (Z6 + Ztan1 + Zmid + Zrad1) / 4 surface = SurfLine( line_list=[line1, line2, line3], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) line1 = Segment(Zmid, Ztan2) point_ref = (Zrad1 + Zmid + Ztan2 + Z5) / 4 surface = SurfLine(line_list=[line1], label="Wind" + st + "_R1_T0_S0", point_ref=point_ref) surf_list.append(surface) # Part 3 (0,1) line1 = Segment(Ztan1, Z3) line2 = Segment(Zrad2, Zmid) point_ref = (Ztan1 + Z3 + Zrad2 + Zmid) / 4 surface = SurfLine( line_list=[line1, line2], label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part4 (1,1) point_ref = (Zmid + Zrad2 + Z4 + Ztan2) / 4 surface = SurfLine(line_list=[], label="Wind" + st + "_R1_T1_S0", point_ref=point_ref) surf_list.append(surface) else: # Part 1 (0,0) line1 = Segment(Z6, Ztan1) line2 = Segment(Ztan1, Zmid) line3 = Segment(Zmid, Zrad1) line4 = Segment(Zrad1, Z6) point_ref = (Z6 + Ztan1 + Zmid + Zrad1) / 4 surface = SurfLine( line_list=[line1, line2, line3, line4], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) line1 = Segment(Zrad1, Zmid) line2 = Segment(Zmid, Ztan2) line3 = Arc1(Ztan2, Z5, self.R2) line4 = Segment(Z5, Zrad1) point_ref = (Zrad1 + Zmid + Ztan2 + Z5) / 4 surface = SurfLine( line_list=[line1, line2, line3, line4], label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 3 (0,1) line1 = Segment(Ztan1, Z3) line2 = Segment(Z3, Zrad2) line3 = Segment(Zrad2, Zmid) line4 = Segment(Zmid, Ztan1) point_ref = (Ztan1 + Z3 + Zrad2 + Zmid) / 4 surface = SurfLine( line_list=[line1, line2, line3, line4], label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part4 (1,1) line1 = Segment(Zmid, Zrad2) line2 = Segment(Zrad2, Z4) line3 = Arc1(Z4, Ztan2, self.R2) line4 = Segment(Ztan2, Zmid) point_ref = (Zmid + Zrad2 + Z4 + Ztan2) / 4 surface = SurfLine( line_list=[line1, line2, line3, line4], label="Wind" + st + "_R1_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Default only one zone # Creation of curve line_list = list() line_list.append(Segment(Z6, Z3)) if self.H1 > 0: line_list.append(Segment(Z3, Z4)) line_list.append(Arc3(Z4, Z5, rot_sign)) if self.H1 > 0: line_list.append(Segment(Z5, Z6)) surface = SurfLine(line_list=line_list, label="Wind" + st + "_R0_T0_S0", point_ref=Zmid) surf_list.append(surface) for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW11 A SlotW11 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float number for rotation (Default value = 0) [rad] delta : complex complex number for translation (Default value = 0) Returns ------- surf_list: list List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" [Z10, Z9, Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1, rot_sign] = self._comp_point_coordinate() rot_sign = -rot_sign Ztan1 = (Z3 + Z8) / 2.0 Ztan2 = (Z5 + Z6) / 2.0 if self.H2 / 2.0 > self.R1: # Zrad1 between Z8 and Z7 Zmid = (Ztan1 + Ztan2) / 2.0 x = fsolve( lambda x: angle((Z7 - (Zmid + 1j * x)) / (Z7 - Z8)), -(self.W2 + self.W1) / 4.0, ) Zrad1 = Zmid + 1j * x[0] Zrad2 = Zrad1.conjugate() surf_list = list() if Nrad == 1 and Ntan == 2: if is_simplified: # no coincident lines allowed # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z8, Ztan1)) curve_list.append(Segment(Ztan1, Ztan2)) point_ref = (Z8 + Ztan1 + Ztan2 + Z6 + Z7) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (0,1) curve_list = list() curve_list.append(Segment(Ztan1, Z3)) point_ref = (Ztan1 + Z3 + Z4 + Z5 + Ztan2) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z8, Ztan1)) curve_list.append(Segment(Ztan1, Ztan2)) if self.W2 > 2 * self.R1: curve_list.append(Segment(Ztan2, Z6)) curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1)) curve_list.append(Segment(Z7, Z8)) point_ref = (Z8 + Ztan1 + Ztan2 + Z6 + Z7) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (0,1) curve_list = list() curve_list.append(Segment(Ztan1, Z3)) curve_list.append(Segment(Z3, Z4)) curve_list.append(Arc1(Z4, Z5, rot_sign * self.R1)) if self.W2 > 2 * self.R1: curve_list.append(Segment(Z5, Ztan2)) curve_list.append(Segment(Ztan2, Ztan1)) point_ref = (Ztan1 + Z3 + Z4 + Z5 + Ztan2) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) elif Nrad == 2 and Ntan == 1 and self.H2 / 2.0 > self.R1: if is_simplified: # no coincident lines allowed # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z8, Z3)) curve_list.append(Segment(Zrad2, Zrad1)) point_ref = (Z8 + Z3 + Zrad2 + Zrad1) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) curve_list = list() point_ref = (Zrad2 + Zrad1 + Z4 + Z5 + Z6 + Z7) / 6 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z8, Z3)) curve_list.append(Segment(Z3, Zrad2)) curve_list.append(Segment(Zrad2, Zrad1)) curve_list.append(Segment(Zrad1, Z8)) point_ref = (Z8 + Z3 + Zrad2 + Zrad1) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) curve_list = list() curve_list.append(Segment(Zrad1, Zrad2)) curve_list.append(Segment(Zrad2, Z4)) curve_list.append(Arc1(Z4, Z5, rot_sign * self.R1)) if self.W2 > 2 * self.R1: curve_list.append(Segment(Z5, Z6)) curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1)) curve_list.append(Segment(Z7, Zrad1)) point_ref = (Zrad2 + Zrad1 + Z4 + Z5 + Z6 + Z7) / 6 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) elif Nrad == 2 and Ntan == 2 and self.H2 / 2.0 > self.R1: if is_simplified: # no coincident lines allowed # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z8, Ztan1)) curve_list.append(Segment(Ztan1, Zmid)) curve_list.append(Segment(Zmid, Zrad1)) point_ref = (Z8 + Ztan1 + Zmid + Zrad1) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) curve_list = list() curve_list.append(Segment(Zmid, Ztan2)) point_ref = (Zrad1 + Zmid + Ztan2 + Z6 + Z7) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part3 (0,1) curve_list = list() curve_list.append(Segment(Ztan1, Z3)) curve_list.append(Segment(Zrad2, Zmid)) point_ref = (Ztan1 + Z3 + Zrad2 + Zmid) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part4 (1,1) curve_list = list() point_ref = (Zmid + Zrad2 + Z4 + Z5 + Ztan2) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z8, Ztan1)) curve_list.append(Segment(Ztan1, Zmid)) curve_list.append(Segment(Zmid, Zrad1)) curve_list.append(Segment(Zrad1, Z8)) point_ref = (Z8 + Ztan1 + Zmid + Zrad1) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) curve_list = list() curve_list.append(Segment(Zrad1, Zmid)) curve_list.append(Segment(Zmid, Ztan2)) if self.W2 > 2 * self.R1: curve_list.append(Segment(Ztan2, Z6)) curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1)) curve_list.append(Segment(Z7, Zrad1)) point_ref = (Zrad1 + Zmid + Ztan2 + Z6 + Z7) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part3 (0,1) curve_list = list() curve_list.append(Segment(Ztan1, Z3)) curve_list.append(Segment(Z3, Zrad2)) curve_list.append(Segment(Zrad2, Zmid)) curve_list.append(Segment(Zmid, Ztan1)) point_ref = (Ztan1 + Z3 + Zrad2 + Zmid) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part4 (1,1) curve_list = list() curve_list.append(Segment(Zmid, Zrad2)) curve_list.append(Segment(Zrad2, Z4)) curve_list.append(Arc1(Z4, Z5, rot_sign * self.R1)) if self.W2 > 2 * self.R1: curve_list.append(Segment(Z5, Ztan2)) curve_list.append(Segment(Ztan2, Zmid)) point_ref = (Zmid + Zrad2 + Z4 + Z5 + Ztan2) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Creation of curve curve_list = list() curve_list.append(Segment(Z8, Z3)) curve_list.append(Segment(Z3, Z4)) if self.R1 * 2 < self.W2: curve_list.append(Arc1(Z4, Z5, rot_sign * self.R1)) curve_list.append(Segment(Z5, Z6)) curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1)) else: # Z5 == Z6 curve_list.append(Arc3(Z4, Z7, not self.is_outwards())) curve_list.append(Segment(Z7, Z8)) surface = SurfLine(line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=Zmid) surf_list.append(surface) 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 : HoleM57 A HoleM57 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 HoleM57 """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" Rbo = self.get_Rbo() # "Tooth" angle (P1',0,P1) alpha_T = 2 * arcsin(self.W3 / (2 * (Rbo - self.H1))) # magnet pole pitch angle (Z1,0,Z1') alpha_S = (2 * pi / self.Zh) - alpha_T # Angle (P1,P1',P4') and (P5',P4', ) alpha = (pi - self.W0) / 2 # Half slot pitch hssp = pi / self.Zh Z1 = (Rbo - self.H1) * exp(-1j * alpha_S / 2) x11 = 2 * sin(alpha_S / 2) * (Rbo - self.H1) # Distance from P1 to P1' # In rect triangle P4, P1, perp (P1,P1') with P4 H = tan(alpha) * (x11 / 2 - self.W1 / 2) Z4 = Z1.real - H - 1j * self.W1 / 2 x45 = self.H2 / cos(alpha) # distance from P4 to P5 Z5 = Z4 - x45 # Get coordinates of "random" points on (P5,P8) and (P1,P8) # In ref P4 center and P1 on X+ axis Z58 = (self.W4 - 1j * self.H2) * exp(1j * angle(Z1 - Z4)) + Z4 # In the tooth ref Z18 = (Rbo - self.H1 - self.H2 + 1j * self.W3 / 2) * exp(-1j * hssp) Z8 = inter_line_line(Z5, Z58, Z1, Z18)[0] # In ref "b" P4 center and P1 on X+ axis Z8b = (Z8 - Z4) * exp(-1j * angle(Z1 - Z4)) Z2 = (Z8b + 1j * self.H2 - self.W2) * exp(1j * angle(Z1 - Z4)) + Z4 Z3 = (Z8b + 1j * self.H2 - self.W2 - self.W4) * exp( 1j * angle(Z1 - Z4)) + Z4 Z7 = (Z8b - self.W2) * exp(1j * angle(Z1 - Z4)) + Z4 Z6 = (Z8b - self.W2 - self.W4) * exp(1j * angle(Z1 - Z4)) + Z4 # 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() surf_list = list() # Z_list = array([Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8]) # plt.plot(Z_list.real, Z_list.imag, "x r") # for ii in range(8): # plt.text(Z_list[ii].real, Z_list[ii].imag, "Z" + str(ii + 1)) # plt.show() # Check schematics: assert abs(abs(Z7 - Z8) - self.W2) < 1e-6 assert abs(abs(Z6 - Z7) - self.W4) < 1e-6 assert abs(abs(Z2 - Z3) - self.W4) < 1e-6 assert abs(abs(Z2 - Z7) - self.H2) < 1e-6 assert abs(abs(Z4 - Z4s) - self.W1) < 1e-6 assert abs(abs(Z5 - Z5s) - self.W1) < 1e-6 # TODO: Create all the surfaces for all the cases # (with/without magnet W1>0 or W1=0) # Air surface (W3) with magnet_0 curve_list_air = list() curve_list_air.append(Segment(Z1, Z2)) curve_list_air.append(Segment(Z2, Z7)) if self.W2 > 0: curve_list_air.append(Segment(Z7, Z8)) curve_list_air.append(Segment(Z8, Z1)) # initiating the label of the line on the air surface curve_list_air = set_name_line(curve_list_air, "hole_1_line") point_ref = (Z1 + Z2 + Z7 + Z8) / 4 S1 = SurfLine(line_list=curve_list_air, label="Air", point_ref=point_ref) # Magnet_0 surface curve_list_mag = list() if is_simplified: curve_list_mag.append(Segment(Z7, Z2)) curve_list_mag.append(Segment(Z3, Z6)) else: curve_list_mag.append(Segment(Z2, Z3)) curve_list_mag.append(Segment(Z3, Z6)) curve_list_mag.append(Segment(Z6, Z7)) curve_list_mag.append(Segment(Z7, Z2)) # initiating the label of the line of the magnet surface curve_list_mag = set_name_line(curve_list_mag, "magnet_1_line") point_ref = (Z2 + Z3 + Z6 + Z7) / 4 S2 = SurfLine( line_list=curve_list_mag, label="Magnet" + st + "_N_R0_T0_S0", point_ref=point_ref, ) # Air surface with magnet_0 and W1 > 0 curve_list_air = list() curve_list_air.append(Segment(Z4, Z5)) curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append(Segment(Z6, Z3)) if abs(Z4 - Z3) > 1e-6: curve_list_air.append(Segment(Z3, Z4)) # initiating the label of the line on the air surface curve_list_air = set_name_line(curve_list_air, "hole_2_line") point_ref = (Z6 + Z5 + Z4) / 3 S3 = SurfLine(line_list=curve_list_air, label="Air", point_ref=point_ref) # Symmetry Air surface (W3) with magnet_1 curve_list_air = list() curve_list_air.append(Segment(Z2s, Z1s)) curve_list_air.append(Segment(Z1s, Z8s)) if self.W2 > 0: curve_list_air.append(Segment(Z8s, Z7s)) curve_list_air.append(Segment(Z7s, Z2s)) point_ref = (Z1s + Z2s + Z8s + Z7s) / 4 # initiating the label of the line on the air surface curve_list_air = set_name_line(curve_list_air, "hole_3_line") S4 = SurfLine(line_list=curve_list_air, label="Air", point_ref=point_ref) # magnet_1 surface curve_list_mag = list() if is_simplified: curve_list_mag.append(Segment(Z2s, Z7s)) curve_list_mag.append(Segment(Z6s, Z3s)) else: curve_list_mag.append(Segment(Z3s, Z2s)) curve_list_mag.append(Segment(Z2s, Z7s)) curve_list_mag.append(Segment(Z7s, Z6s)) curve_list_mag.append(Segment(Z6s, Z3s)) point_ref = (Z3s + Z2s + Z7s + Z6s) / 4 # initiating the label of the line on the magnet surface curve_list_mag = set_name_line(curve_list_mag, "magnet_2_line") S5 = SurfLine( line_list=curve_list_mag, label="Magnet" + st + "_N_R0_T1_S0", point_ref=point_ref, ) # Air surface with magnet_1 and W1 > 0 curve_list_air = list() curve_list_air.append(Segment(Z3s, Z6s)) curve_list_air.append(Segment(Z6s, Z5s)) curve_list_air.append(Segment(Z5s, Z4s)) if abs(Z4 - Z3) > 1e-6: curve_list_air.append(Segment(Z4s, Z3s)) point_ref = (Z3s + Z6s + Z5s) / 3 # initiating the label of the line on the air surface curve_list_air = set_name_line(curve_list_air, "hole_4_line") S6 = SurfLine(line_list=curve_list_air, label="Air", point_ref=point_ref) # Air surface between magnet_0 and magnet_1 with W1 == 0 curve_list_air = list() curve_list_air.append(Segment(Z3, Z4)) curve_list_air.append(Segment(Z4, Z3s)) curve_list_air.append(Segment(Z3s, Z6s)) curve_list_air.append(Segment(Z6s, Z5)) curve_list_air.append(Segment(Z5, Z6)) curve_list_air.append(Segment(Z6, Z3)) # initiating the label of the line on the air surface curve_list_air = set_name_line(curve_list_air, "hole_2_line") point_ref = (Z5 + Z4) / 2 S7 = SurfLine(line_list=curve_list_air, label="Air", 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: surf_list = [S1, S2, S3, S6, S5, S4] elif self.magnet_0 and self.magnet_1 and self.W1 == 0: surf_list = [S1, S2, S7, S5, S4] # elif self.magnet_0 and not self.magnet_1 and self.W1 > 0: # surf_list = [S1, S2, S3, S9] # elif self.magnet_0 and not self.magnet_1 and self.W1 == 0: # surf_list = [S1, S2, S10] # elif not self.magnet_0 and self.magnet_1 and self.W1 > 0: # surf_list = [S8, S6, S5, S4] # elif not self.magnet_0 and self.magnet_1 and self.W1 == 0: # surf_list = [S11, S5, S4] # elif not self.magnet_0 and not self.magnet_1 and self.W1 > 0: # surf_list = [S8, S9] # elif not self.magnet_0 and not self.magnet_1 and self.W1 == 0: # surf_list = [S12] # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def test_Lam_Wind_10_wind_22(self): """Test machine plot with Slot 10 and winding rad=2, tan=2 """ print("\nTest plot Slot 10") plt.close("all") test_obj = Machine() test_obj.rotor = LamSlotWind( Rint=0.2, Rext=0.5, is_internal=True, is_stator=False, L1=0.95, Nrvd=1, Wrvd=0.05, ) test_obj.rotor.slot = SlotW10( Zs=6, W0=50e-3, W1=90e-3, W2=100e-3, H0=20e-3, H1=35e-3, H2=130e-3, H1_is_rad=False, ) test_obj.rotor.winding = WindingUD( user_wind_mat=wind_mat, qs=4, p=4, Lewout=60e-3 ) test_obj.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=1) test_obj.stator = LamSlotWind( Rint=0.51, Rext=0.8, is_internal=False, is_stator=True, L1=0.95, Nrvd=1, Wrvd=0.05, ) test_obj.stator.slot = SlotW10( Zs=6, W0=50e-3, W1=80e-3, W2=50e-3, H0=15e-3, H1=25e-3, H2=140e-3, H1_is_rad=False, ) test_obj.stator.winding = WindingUD( user_wind_mat=wind_mat, qs=4, p=4, Lewout=60e-3 ) test_obj.frame = Frame(Rint=0.8, Rext=0.9, Lfra=1) test_obj.frame.mat_type.name = "M330_35A" test_obj.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s10_1-Machine.png")) # Rotor + Stator + 2 for frame + 1 for Shaft self.assertEqual(len(fig.axes[0].patches), 55) test_obj.rotor.plot() fig = plt.gcf() self.assertEqual(len(fig.axes[0].patches), 26) fig.savefig(join(save_path, "test_Lam_Wind_s10_2-Rotor.png")) # 2 for lam + Zs*4 for wind self.assertEqual(len(fig.axes[0].patches), 26) test_obj.stator.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s10_3-Stator.png")) # 2 for lam + Zs*4 for wind self.assertEqual(len(fig.axes[0].patches), 26) lines = test_obj.stator.slot.build_geometry_half_tooth(is_top=False) surf = SurfLine(line_list=lines) surf.plot_lines() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s10_Tooth_bottom_out.png")) lines = test_obj.stator.slot.build_geometry_half_tooth(is_top=True) surf = SurfLine(line_list=lines) surf.plot_lines() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s10_Tooth_top_out.png")) lines = test_obj.rotor.slot.build_geometry_half_tooth(is_top=False) surf = SurfLine(line_list=lines) surf.plot_lines() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s10_Tooth_bottom_in.png")) lines = test_obj.rotor.slot.build_geometry_half_tooth(is_top=True) surf = SurfLine(line_list=lines) surf.plot_lines() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s10_Tooth_top_in.png")) tooth = test_obj.rotor.slot.get_surface_tooth() tooth.plot(color="r") fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s10_Tooth_in.png")) tooth = test_obj.stator.slot.get_surface_tooth() tooth.plot(color="r") fig = plt.gcf() mesh_dict = tooth.comp_mesh_dict(5e-3) for line in tooth.get_lines(): mid = line.get_middle() plt.text(mid.real, mid.imag, str(mesh_dict[line.label])) fig.savefig(join(save_path, "test_Lam_Wind_s10_Tooth_out.png"))
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW22 A SlotW22 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : Complex complex for translation (Default value = 0) Returns ------- surf_list: List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" Rbo = self.get_Rbo() # Polar Meshgrid if self.is_outwards(): r = linspace(Rbo + self.H0, Rbo + self.H0 + self.H2, Nrad + 1) else: r = linspace(Rbo - self.H0, Rbo - self.H0 - self.H2, Nrad + 1) theta = linspace(-self.W2 / 2.0, self.W2 / 2.0, Ntan + 1) Z = meshgrid(r, theta) Z = Z[0] * exp(1j * Z[1]) Z = Z.T if self.is_outwards(): assert Z[0][0] == (Rbo + self.H0) * exp(-1j * self.W2 * 0.5) # Z6 assert Z[Nrad][0] == (Rbo + self.H0 + self.H2) * exp( -1j * self.W2 * 0.5) # Z5 assert Z[0][Ntan] == (Rbo + self.H0) * exp(1j * self.W2 * 0.5) # Z3 assert Z[Nrad][Ntan] == (Rbo + self.H0 + self.H2) * exp( 1j * self.W2 * 0.5) # Z4 else: assert Z[0][0] == (Rbo - self.H0) * exp(-1j * self.W2 * 0.5) # Z6 assert Z[Nrad][0] == (Rbo - self.H0 - self.H2) * exp( -1j * self.W2 * 0.5) # Z5 assert Z[0][Ntan] == (Rbo - self.H0) * exp(1j * self.W2 * 0.5) # Z3 assert Z[Nrad][Ntan] == (Rbo - self.H0 - self.H2) * exp( 1j * self.W2 * 0.5) # Z4 surf_list = list() for jj in range(Ntan): # jj from 0 to Ntan-1 for ii in range(Nrad): # ii from 0 to Nrad-1 Z1 = Z[ii][jj] Z2 = Z[ii][jj + 1] Z3 = Z[ii + 1][jj + 1] Z4 = Z[ii + 1][jj] point_ref = ( Z[ii][jj] + Z[ii][jj + 1] + Z[ii + 1][jj + 1] + Z[ii + 1][jj]) / 4 # the reference point of the surface if is_simplified: # No doubling Line allowed curve_list = list() if ii == 0: curve_list.append(Arc1(Z1, Z2, abs(Z1))) if jj != Ntan - 1: curve_list.append(Segment(Z2, Z3)) if ii != Nrad - 1: curve_list.append(Arc1(Z3, Z4, -abs(Z3))) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R" + str(ii) + "_T" + str(jj) + "_S0", point_ref=point_ref, ) surf_list.append(surface) else: curve_list = list() curve_list.append(Arc1(Z1, Z2, abs(Z1))) curve_list.append(Segment(Z2, Z3)) curve_list.append(Arc1(Z3, Z4, -abs(Z3))) curve_list.append(Segment(Z4, Z1)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R" + str(ii) + "_T" + str(jj) + "_S0", point_ref=point_ref, ) surf_list.append(surface) for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW29 A SlotW29 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : Complex complex for translation (Default value = 0) Returns ------- surf_list: list List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" [Z12, Z11, Z10, Z9, Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1] = self._comp_point_coordinate() X = linspace(Z8, Z7, Nrad + 1) # Nrad+1 and Ntan+1 because 3 points => 2 zones Z = zeros((Nrad + 1, Ntan + 1), dtype=complex) for ii in range(Nrad + 1): Z[ii][:] = linspace(X[ii], X[ii].conjugate(), Ntan + 1) assert Z[0][0] == Z8 assert Z[Nrad][0] == Z7 assert Z[0][Ntan] == Z5 assert Z[Nrad][Ntan] == Z6 Z_8 = Z5 + (self.W2 / 2) + (self.W1 / 2) Z_5 = Z5 + (self.W2 / 2) - (self.W1 / 2) # We go thought the zone by Rad then Tan, starting by (0,0) surf_list = list() for jj in range(Ntan): # jj from 0 to Ntan-1 for ii in range(Nrad): # ii from 0 to Nrad-1 Z1 = Z[ii][jj] Z2 = Z[ii][jj + 1] Z3 = Z[ii + 1][jj + 1] Z4 = Z[ii + 1][jj] point_ref = (Z1 + Z2 + Z3 + Z4) / 4 # With one zone the order would be [Z7,Z4,Z5,Z6] if is_simplified: curve_list = list() if ii == 0: if Z1 > Z_8 and Z_5 < Z2 < Z_8: curve_list.append(Segment(Z_8, Z2)) elif Z_5 < Z1 < Z_8 and Z_5 < Z2 < Z_8: curve_list.append(Segment(Z1, Z2)) elif Z2 < Z_5 and Z_5 < Z1 < Z_8: curve_list.append(Segment(Z1, Z_5)) if jj != Ntan - 1: curve_list.append(Segment(Z2, Z3)) if ii != Nrad - 1: curve_list.append(Segment(Z3, Z4)) label = "Wind" + st + "_R" + str(ii) + "_T" + str(jj) + "_S0" surface = SurfLine(line_list=curve_list, label=label, point_ref=point_ref) surf_list.append(surface) else: curve_list = list() curve_list.append(Segment(Z1, Z2)) curve_list.append(Segment(Z2, Z3)) curve_list.append(Segment(Z3, Z4)) curve_list.append(Segment(Z4, Z1)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R" + str(ii) + "_T" + str(jj) + "_S0", point_ref=point_ref, ) surf_list.append(surface) for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def get_sliding_band(sym, lam_int, lam_ext): """Returns a list of surface in the airgap including the sliding band surface Parameters ---------- sym: int Symmetry factor (1= full machine, 2= half of the machine...) Rgap_mec_int: float Internal lamination mechanic radius Rgap_mec_ext: float External lamination mechanic radius Returns ------- surf_list: list List of surface in the airgap including the sliding band surface """ Rgap_mec_int = lam_int.comp_radius_mec() Rgap_mec_ext = lam_ext.comp_radius_mec() Rgap_mag_int = lam_int.Rext Rgap_mag_ext = lam_ext.Rint Wgap_mec = Rgap_mec_ext - Rgap_mec_int W_sb = Wgap_mec / 3 # Width sliding band surf_list = list() if sym == 1: # Complete machine # Bottom sliding band surf_list.append( Circle( center=0, radius=Rgap_mec_int + W_sb, label="Airgap", point_ref=(Rgap_mec_int + W_sb / 2) * exp(1j * pi / 2), line_label="sliding_line", )) # Top sliding band surf_list.append( Circle( center=0, radius=Rgap_mec_int + 2 * W_sb, label="Airgap", point_ref=(Rgap_mec_ext - W_sb / 2) * exp(1j * pi / 2), line_label="sliding_line", )) # Middle surf_list.append( SurfLine( line_list=[], point_ref=(Rgap_mec_int + W_sb * 3 / 2) * exp(1j * pi / 2), label="No_mesh", )) else: # Symmetry # Bottom line Z1 = Rgap_mag_int Z2 = Rgap_mec_int + W_sb Z3 = Z2 * exp(1j * 2 * pi / sym) Z4 = Z1 * exp(1j * 2 * pi / sym) airgap_lines = list() airgap_lines.append(Segment(begin=Z1, end=Z2, label="airgap_line_1")) airgap_lines.append( Arc1(begin=Z2, end=Z3, radius=Rgap_mec_int + W_sb, label="sliding_line")) airgap_lines.append(Segment(begin=Z3, end=Z4, label="airgap_line_1")) surf_list.append( SurfLine( line_list=airgap_lines, point_ref=(Z2 - W_sb / 2) * exp(1j * pi / sym), label="Airgap", )) # Top line Z5 = Rgap_mag_ext Z6 = Rgap_mec_ext - W_sb Z7 = Z6 * exp(1j * 2 * pi / sym) Z8 = Z5 * exp(1j * 2 * pi / sym) airgap_lines = list() airgap_lines.append(Segment(begin=Z5, end=Z6, label="airgap_line_2")) airgap_lines.append( Arc1(begin=Z6, end=Z7, radius=Rgap_mec_ext - W_sb, label="sliding_line")) airgap_lines.append(Segment(begin=Z7, end=Z8, label="airgap_line_2")) surf_list.append( SurfLine( line_list=airgap_lines, point_ref=(Z6 + W_sb / 2) * exp(1j * pi / sym), label="Airgap", )) 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 = "S" else: st = "R" 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)) 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="Air", 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 S2 = SurfLine( line_list=curve_list_mag, label="Magnet" + st + "_N_R0_T0_S0", 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="Air", 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)) if self.H4 > 0: curve_list_air.append(Segment(Z11s, Z1s)) point_ref = (Z1s + Z2s + Z3s + Z8cs + Z9s + Z10s + Z11) / 7 S4 = SurfLine(line_list=curve_list_air, label="Air", 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 S5 = SurfLine( line_list=curve_list_mag, label="Magnet" + st + "_N_R0_T1_S0", 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="Air", 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="Air", 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)) 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="Air", 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)) 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="Air", 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)) 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="Air", 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)) 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="Air", 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)) 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)) 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="Air", 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: surf_list = [S1, S2, S3, S6, S5, S4] elif self.magnet_0 and self.magnet_1 and self.W1 == 0: surf_list = [S1, S2, S7, S5, S4] elif self.magnet_0 and not self.magnet_1 and self.W1 > 0: surf_list = [S1, S2, S3, S9] elif self.magnet_0 and not self.magnet_1 and self.W1 == 0: surf_list = [S1, S2, S10] elif not self.magnet_0 and self.magnet_1 and self.W1 > 0: surf_list = [S8, S6, S5, S4] elif not self.magnet_0 and self.magnet_1 and self.W1 == 0: surf_list = [S11, S5, S4] elif not self.magnet_0 and not self.magnet_1 and self.W1 > 0: surf_list = [S8, S9] elif not self.magnet_0 and not self.magnet_1 and self.W1 == 0: surf_list = [S12] # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW27 A SlotW27 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : Complex complex for translation (Default value = 0) Returns ------- surf_list: list List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" # getting points coordinate [Z1, Z3, Z4, Z5, Z6, Z7, Z8] = self._comp_point_coordinate() Ztan1 = (Z3 + Z8) / 2.0 Ztan2 = (Z5 + Z6) / 2.0 Zmid = (Ztan1 + Ztan2) / 2.0 if self.is_trap_wind: Zrad1 = Z7 Zrad2 = Z4 Zmid = (Z7 + Z4) / 2.0 elif self.H1 < self.H2: # Zrad1 between Z6 and Z7 x = fsolve( lambda x: angle((Z7 - (Zmid + 1j * x)) / (Z7 - Z6)), -(self.W2 + self.W3) / 4.0, ) Zrad1 = Zmid + 1j * x[0] Zrad2 = Zrad1.conjugate() elif self.H1 > self.H2: # Zrad1 between Z8 and Z7 x = fsolve( lambda x: angle((Z7 - (Zmid + 1j * x)) / (Z7 - Z8)), -(self.W2 + self.W1) / 4.0, ) Zrad1 = Zmid + 1j * x[0] Zrad2 = Zrad1.conjugate() else: Zrad1 = Z7 Zrad2 = Z4 Z_3 = Ztan1 - (self.W0 * 1j / 2) Z_8 = Ztan1 + (self.W0 * 1j / 2) surf_list = list() if Nrad == 1 and Ntan == 2: if is_simplified: # Part 1 (0,0) point_list = [Z8, Ztan1, Ztan2, Z6, Z7] res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) curve_list = list() curve_list.append(Segment(Z_8, Ztan1)) curve_list.append(Segment(Ztan1, Ztan2)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 2 (0,1) point_list = [Ztan1, Z3, Z4, Z5, Ztan2] res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) curve_list = list() curve_list.append(Segment(Ztan1, Z_3)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) surf_list.append( gen_curve_list([Z8, Ztan1, Ztan2, Z6, Z7], "0", "0", st)) # Part 2 (0,1) surf_list.append( gen_curve_list([Ztan1, Z3, Z4, Z5, Ztan2], "0", "1", st)) elif Nrad == 2 and Ntan == 1: if is_simplified: # Part 1 (0,0) if not self.is_trap_wind and self.H2 > self.H1: point_list = [Z8, Z3, Z4, Zrad2, Zrad1, Z7] else: # H2 == H1 point_list = [Z8, Z3, Zrad2, Zrad1] res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) curve_list = list() curve_list.append(Segment(Z_8, Z_3)) curve_list.append(Segment(Zrad2, Zrad1)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 2 (1,0) if not self.is_trap_wind and self.H1 > self.H2: point_list = [Zrad1, Zrad2, Z4, Z5, Z6, Z7] else: point_list = [Zrad1, Zrad2, Z5, Z6] res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) curve_list = list() surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) if not self.is_trap_wind and self.H2 > self.H1: point_list = [Z8, Z3, Z4, Zrad2, Zrad1, Z7] else: # H2 == H1 point_list = [Z8, Z3, Zrad2, Zrad1] surf_list.append(gen_curve_list(point_list, "0", "0", st)) # Part 2 (1,0) if not self.is_trap_wind and self.H1 > self.H2: point_list = [Zrad1, Zrad2, Z4, Z5, Z6, Z7] else: point_list = [Zrad1, Zrad2, Z5, Z6] surf_list.append(gen_curve_list(point_list, "1", "0", st)) elif Nrad == 2 and Ntan == 2: if is_simplified: # Part 1 (0,0) if not self.is_trap_wind and self.H2 > self.H1: point_list = [Z8, Ztan1, Zmid, Zrad1, Z7] else: # H2 == H1 point_list = [Z8, Ztan1, Zmid, Zrad1] res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) curve_list = list() curve_list.append(Segment(Z_8, Ztan1)) curve_list.append(Segment(Ztan1, Zmid)) curve_list.append(Segment(Ztan1, Zrad1)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 2 (1,0) if not self.is_trap_wind and self.H1 > self.H2: point_list = [Zrad1, Zmid, Ztan2, Z6, Z7] else: point_list = [Zrad1, Zmid, Ztan2, Z6] res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) curve_list = list() curve_list.append(Segment(Zmid, Ztan2)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 3 (0,1) if not self.is_trap_wind and self.H2 > self.H1: point_list = [Ztan1, Z3, Z4, Zrad2, Zmid] else: # H2 == H1 point_list = [Ztan1, Z3, Zrad2, Zmid] res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) curve_list = list() curve_list.append(Segment(Ztan1, Z_3)) curve_list.append(Segment(Zrad2, Zmid)) surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 4 (1,1) if not self.is_trap_wind and self.H1 > self.H2: point_list = [Zmid, Zrad2, Z4, Z5, Ztan2] else: # H2 == H1 point_list = [Zmid, Zrad2, Z5, Ztan2] res = 0 for Z in point_list: res += Z point_ref = res / len(point_list) curve_list = list() surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) if not self.is_trap_wind and self.H2 > self.H1: point_list = [Z8, Ztan1, Zmid, Zrad1, Z7] else: # H2 == H1 point_list = [Z8, Ztan1, Zmid, Zrad1] surf_list.append(gen_curve_list(point_list, "0", "0", st)) # Part 2 (1,0) if not self.is_trap_wind and self.H1 > self.H2: point_list = [Zrad1, Zmid, Ztan2, Z6, Z7] else: point_list = [Zrad1, Zmid, Ztan2, Z6] surf_list.append(gen_curve_list(point_list, "1", "0", st)) # Part 3 (0,1) if not self.is_trap_wind and self.H2 > self.H1: point_list = [Ztan1, Z3, Z4, Zrad2, Zmid] else: # H2 == H1 point_list = [Ztan1, Z3, Zrad2, Zmid] surf_list.append(gen_curve_list(point_list, "0", "1", st)) # Part 4 (1,1) if not self.is_trap_wind and self.H1 > self.H2: point_list = [Zmid, Zrad2, Z4, Z5, Ztan2] else: # H2 == H1 point_list = [Zmid, Zrad2, Z5, Ztan2] surf_list.append(gen_curve_list(point_list, "1", "1", st)) else: surf_list.append(gen_curve_list([Z8, Z3, Z4, Z5, Z6, Z7], "0", "0", st)) for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW28 A SlotW28 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : Complex complex for translation (Default value = 0) Returns ------- surf_list: list List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, rot_sign] = self._comp_point_coordinate() if self.is_outwards(): Ztan2 = Z5 + Z5.imag * (1 - 1j) else: Ztan2 = Z5 + Z5.imag * (-1 - 1j) Rarc = abs(Z5.imag) # Radius of the top arc Ztan1 = (Z2 + Z7) / 2.0 Zmid = (Ztan1 + Ztan2) / 2.0 # Zrad1 between Z5 and Z6 x = fsolve(lambda x: angle((Z6 - (Zmid + 1j * x)) / (Z6 - Z5)), -self.R1) Zrad1 = Zmid + 1j * x[0] Zrad2 = Zrad1.conjugate() Zmid = (Ztan1 + Ztan2) / 2.0 # We can split in rad only if Zrad1 is between Z6 and Z5 is_rad_splittable = self.H3 > 0 and ( (Z6.real < Zrad1.real and Zrad1.real < Z5.real) or (Z5.real < Zrad1.real and Zrad1.real < Z6.real)) # Creation of curve surf_list = list() if Nrad == 1 and Ntan == 2: if is_simplified: # No doubling Line allowed # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z7, Ztan1)) curve_list.append(Segment(Ztan1, Ztan2)) point_ref = (Z7 + Ztan1 + Ztan2 + Z5 + Z6) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (0,1) curve_list = list() curve_list.append(Segment(Ztan1, Z2)) point_ref = (Ztan1 + Z2 + Z3 + Z4 + Ztan2) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Ztan1, Z2)) curve_list.append(Arc1(Z2, Z3, rot_sign * self.R1)) curve_list.append(Segment(Z3, Z4)) curve_list.append(Arc1(Z4, Ztan2, rot_sign * Rarc)) curve_list.append(Segment(Ztan2, Ztan1)) point_ref = (Ztan1 + Z2 + Z3 + Z4 + Ztan2) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (0,1) curve_list = list() curve_list.append(Segment(Z7, Ztan1)) curve_list.append(Segment(Ztan1, Ztan2)) curve_list.append(Arc1(Ztan2, Z5, rot_sign * Rarc)) curve_list.append(Segment(Z5, Z6)) curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1)) point_ref = (Z7 + Ztan1 + Ztan2 + Z5 + Z6) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) elif Nrad == 2 and Ntan == 1 and is_rad_splittable: if is_simplified: # No doubling Line allowed # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z7, Z2)) curve_list.append(Segment(Zrad2, Zrad1)) point_ref = (Z7 + Z2 + Z3 + Zrad2 + Zrad1 + Z6) / 6 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) curve_list = list() point_ref = (Zrad1 + Zrad2 + Z4 + Z5) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z7, Z2)) curve_list.append(Arc1(Z2, Z3, rot_sign * self.R1)) curve_list.append(Segment(Z3, Zrad2)) curve_list.append(Segment(Zrad2, Zrad1)) curve_list.append(Segment(Zrad1, Z6)) curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1)) point_ref = (Z7 + Z2 + Z3 + Zrad2 + Zrad1 + Z6) / 6 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) curve_list = list() curve_list.append(Segment(Zrad1, Zrad2)) curve_list.append(Segment(Zrad2, Z4)) curve_list.append(Arc3(Z4, Z5, self.is_outwards())) curve_list.append(Segment(Z5, Zrad1)) point_ref = (Zrad1 + Zrad2 + Z4 + Z5) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) elif Nrad == 2 and Ntan == 2 and is_rad_splittable: if is_simplified: # No doubling Line allowed # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z7, Ztan1)) curve_list.append(Segment(Ztan1, Zmid)) curve_list.append(Segment(Zmid, Zrad1)) point_ref = (Z7 + Ztan1 + Zmid + Zrad1 + Z6) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) curve_list = list() curve_list.append(Segment(Zmid, Ztan2)) point_ref = (Zrad1 + Zmid + Ztan2 + Z5) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 3 (0,1) curve_list = list() curve_list.append(Segment(Ztan1, Z2)) curve_list.append(Segment(Zrad2, Zmid)) point_ref = (Ztan1 + Z2 + Z3 + Zrad2 + Zmid) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part4 (1,1) curve_list = list() point_ref = (Zmid + Zrad2 + Z4 + Ztan2) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) curve_list = list() curve_list.append(Segment(Z7, Ztan1)) curve_list.append(Segment(Ztan1, Zmid)) curve_list.append(Segment(Zmid, Zrad1)) curve_list.append(Segment(Zrad1, Z6)) curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1)) point_ref = (Z7 + Ztan1 + Zmid + Zrad1 + Z6) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) curve_list = list() curve_list.append(Segment(Zrad1, Zmid)) curve_list.append(Segment(Zmid, Ztan2)) curve_list.append(Arc1(Ztan2, Z5, rot_sign * Rarc)) curve_list.append(Segment(Z5, Zrad1)) point_ref = (Zrad1 + Zmid + Ztan2 + Z5) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 3 (0,1) curve_list = list() curve_list.append(Segment(Ztan1, Z2)) curve_list.append(Arc1(Z2, Z3, rot_sign * self.R1)) curve_list.append(Segment(Z3, Zrad2)) curve_list.append(Segment(Zrad2, Zmid)) curve_list.append(Segment(Zmid, Ztan1)) point_ref = (Ztan1 + Z2 + Z3 + Zrad2 + Zmid) / 5 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part4 (1,1) curve_list = list() curve_list.append(Segment(Zmid, Zrad2)) curve_list.append(Segment(Zrad2, Z4)) curve_list.append(Arc1(Z4, Ztan2, rot_sign * Rarc)) curve_list.append(Segment(Ztan2, Zmid)) point_ref = (Zmid + Zrad2 + Z4 + Ztan2) / 4 surface = SurfLine( line_list=curve_list, label="Wind" + st + "_R1_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Default : only one zone # Only one zone for type 2_6 for now curve_list = self.build_geometry() # Remove the isthmus part curve_list = curve_list[1:-1] curve_list = [Segment(curve_list[-1].end, curve_list[0].begin) ] + curve_list surface = SurfLine(line_list=curve_list, label="Wind" + st + "_R0_T0_S0", point_ref=Zmid) surf_list.append(surface) 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 : HoleM57 A HoleM57 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 HoleM57 """ # Get correct label for surfaces lam_label = self.parent.get_label() R_id, surf_type = self.get_R_id() vent_label = lam_label + "_" + surf_type + "_R" + str(R_id) + "-" mag_label = lam_label + "_" + HOLEM_LAB + "_R" + str(R_id) + "-" # Get all the points point_dict = self._comp_point_coordinate() Z1 = point_dict["Z1"] Z2 = point_dict["Z2"] Z3 = point_dict["Z3"] Z4 = point_dict["Z4"] Z5 = point_dict["Z5"] Z6 = point_dict["Z6"] Z7 = point_dict["Z7"] Z8 = point_dict["Z8"] Z1s = point_dict["Z1s"] Z2s = point_dict["Z2s"] Z3s = point_dict["Z3s"] Z4s = point_dict["Z4s"] Z5s = point_dict["Z5s"] Z6s = point_dict["Z6s"] Z7s = point_dict["Z7s"] Z8s = point_dict["Z8s"] surf_list = list() # Z_list = array([Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8]) # plt.plot(Z_list.real, Z_list.imag, "x r") # for ii in range(8): # plt.text(Z_list[ii].real, Z_list[ii].imag, "Z" + str(ii + 1)) # plt.show() # Check schematics: assert abs(abs(Z7 - Z8) - self.W2) < 1e-6 assert abs(abs(Z6 - Z7) - self.W4) < 1e-6 assert abs(abs(Z2 - Z3) - self.W4) < 1e-6 assert abs(abs(Z2 - Z7) - self.H2) < 1e-6 assert abs(abs(Z4 - Z4s) - self.W1) < 1e-6 assert abs(abs(Z5 - Z5s) - self.W1) < 1e-6 # TODO: Create all the surfaces for all the cases # (with/without magnet W1>0 or W1=0) # Air surface (W3) with magnet_0 curve_list = list() curve_list.append(Segment(Z1, Z2)) curve_list.append(Segment(Z2, Z7)) if self.W2 > 0: curve_list.append(Segment(Z7, Z8)) curve_list.append(Segment(Z8, Z1)) # initiating the label of the line on the air surface # curve_list = set_name_line(curve_list, "hole_1_line") point_ref = (Z1 + Z2 + Z7 + Z8) / 4 S1 = SurfLine(line_list=curve_list, label=vent_label + "T0-S0", point_ref=point_ref) # Magnet_0 surface curve_list = list() if is_simplified: curve_list.append(Segment(Z7, Z2)) curve_list.append(Segment(Z3, Z6)) else: curve_list.append(Segment(Z2, Z3)) curve_list.append(Segment(Z3, Z6)) curve_list.append(Segment(Z6, Z7)) curve_list.append(Segment(Z7, Z2)) # initiating the label of the line of the magnet surface # curve_list = set_name_line(curve_list, "magnet_1_line") point_ref = (Z2 + Z3 + Z6 + Z7) / 4 S2 = SurfLine( line_list=curve_list, label=mag_label + "T0-S0", point_ref=point_ref, ) # Air surface with magnet_0 and W1 > 0 curve_list = list() curve_list.append(Segment(Z4, Z5)) curve_list.append(Segment(Z5, Z6)) curve_list.append(Segment(Z6, Z3)) if abs(Z4 - Z3) > 1e-6: curve_list.append(Segment(Z3, Z4)) # initiating the label of the line on the air surface # curve_list = set_name_line(curve_list, "hole_2_line") point_ref = (Z6 + Z5 + Z4) / 3 S3 = SurfLine(line_list=curve_list, label=vent_label + "T1-S0", point_ref=point_ref) # Symmetry Air surface (W3) with magnet_1 curve_list = list() curve_list.append(Segment(Z2s, Z1s)) curve_list.append(Segment(Z1s, Z8s)) if self.W2 > 0: curve_list.append(Segment(Z8s, Z7s)) curve_list.append(Segment(Z7s, Z2s)) point_ref = (Z1s + Z2s + Z8s + Z7s) / 4 # initiating the label of the line on the air surface # curve_list = set_name_line(curve_list, "hole_3_line") S4 = SurfLine(line_list=curve_list, label=vent_label + "T2-S0", point_ref=point_ref) # magnet_1 surface curve_list = list() if is_simplified: curve_list.append(Segment(Z2s, Z7s)) curve_list.append(Segment(Z6s, Z3s)) else: curve_list.append(Segment(Z3s, Z2s)) curve_list.append(Segment(Z2s, Z7s)) curve_list.append(Segment(Z7s, Z6s)) curve_list.append(Segment(Z6s, Z3s)) point_ref = (Z3s + Z2s + Z7s + Z6s) / 4 # initiating the label of the line on the magnet surface # curve_list = set_name_line(curve_list, "magnet_2_line") S5 = SurfLine( line_list=curve_list, label=mag_label + "T1-S0", point_ref=point_ref, ) # Air surface with magnet_1 and W1 > 0 curve_list = list() curve_list.append(Segment(Z3s, Z6s)) curve_list.append(Segment(Z6s, Z5s)) curve_list.append(Segment(Z5s, Z4s)) if abs(Z4 - Z3) > 1e-6: curve_list.append(Segment(Z4s, Z3s)) point_ref = (Z3s + Z6s + Z5s) / 3 # initiating the label of the line on the air surface # curve_list = set_name_line(curve_list, "hole_4_line") S6 = SurfLine(line_list=curve_list, label=vent_label + "T1-S0", point_ref=point_ref) # Air surface between magnet_0 and magnet_1 with W1 == 0 curve_list = list() curve_list.append(Segment(Z3, Z4)) curve_list.append(Segment(Z4, Z3s)) curve_list.append(Segment(Z3s, Z6s)) curve_list.append(Segment(Z6s, Z5)) curve_list.append(Segment(Z5, Z6)) curve_list.append(Segment(Z6, Z3)) # initiating the label of the line on the air surface # curve_list = set_name_line(curve_list, "hole_2_line") point_ref = (Z5 + Z4) / 2 S7 = SurfLine(line_list=curve_list, label=vent_label + "T2-S0", point_ref=point_ref) # Air surface without magnet_0 and W1 > 0 curve_list = list() curve_list.append(Segment(Z1, Z8)) curve_list.append(Segment(Z8, Z5)) curve_list.append(Segment(Z5, Z4)) curve_list.append(Segment(Z4, Z1)) # initiating the label of the line on the air surface # curve_list = set_name_line(curve_list, "hole_1_line") point_ref = (Z5 + Z1) / 2 S8 = SurfLine(line_list=curve_list, label=vent_label + "T1-S0", point_ref=point_ref) # Air surface without magnet_1 and W1 > 0 curve_list = list() curve_list.append(Segment(Z1s, Z8s)) curve_list.append(Segment(Z8s, Z5s)) curve_list.append(Segment(Z5s, Z4s)) curve_list.append(Segment(Z4s, Z1s)) # initiating the label of the line on the air surface # curve_list = set_name_line(curve_list, "hole_2_line") point_ref = (Z5s + Z1s) / 2 S9 = SurfLine(line_list=curve_list, label=vent_label + "T0-S0", point_ref=point_ref) # Air surface No magnet and W1 == 0 curve_list = list() curve_list.append(Segment(Z4, Z1)) curve_list.append(Segment(Z1, Z8)) curve_list.append(Segment(Z8, Z5)) curve_list.append(Segment(Z5, Z8s)) curve_list.append(Segment(Z8s, Z1s)) curve_list.append(Segment(Z1s, Z4)) # initiating the label of the line on the air surface # curve_list = set_name_line(curve_list, "hole_1_line") point_ref = (Z4 + Z5) / 2 S12 = SurfLine( line_list=curve_list, label=vent_label + "T0-S0", point_ref=point_ref ) # TODO correct vent_label TX id # Create the surface list by selecting the correct ones if self.magnet_0 and self.magnet_1 and self.W1 > 0: surf_list = [S1, S2, S3, S6, S5, S4] elif self.magnet_0 and self.magnet_1 and self.W1 == 0: surf_list = [S1, S2, S7, S5, S4] # elif self.magnet_0 and not self.magnet_1 and self.W1 > 0: # surf_list = [S1, S2, S3, S9] # elif self.magnet_0 and not self.magnet_1 and self.W1 == 0: # surf_list = [S1, S2, S10] # elif not self.magnet_0 and self.magnet_1 and self.W1 > 0: # surf_list = [S8, S6, S5, S4] # elif not self.magnet_0 and self.magnet_1 and self.W1 == 0: # surf_list = [S11, S5, S4] elif not self.magnet_0 and not self.magnet_1 and self.W1 > 0: surf_list = [S8, S9] elif not self.magnet_0 and not self.magnet_1 and self.W1 == 0: surf_list = [S12] else: raise Exception("Not implemented Yet") # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry_wind(self, Nrad, Ntan, is_simplified=False, alpha=0, delta=0): """Split the slot winding area in several zone Parameters ---------- self : SlotW15 A SlotW15 object Nrad : int Number of radial layer Ntan : int Number of tangentiel layer is_simplified : bool boolean to specify if coincident lines are considered as one or different lines (Default value = False) alpha : float Angle for rotation (Default value = 0) [rad] delta : Complex complex for translation (Default value = 0) Returns ------- surf_list: List of surface delimiting the winding zone """ if self.get_is_stator(): # check if the slot is on the stator st = "S" else: st = "R" [ Z13, Z12, Z11, Z10, Z9, Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1, ] = self._comp_point_coordinate() Ztan1 = (Z2 + Z12) / 2.0 Ztan2 = Z7 Zmid = (Ztan1 + Ztan2) / 2.0 # Zrad1 between Z10 and Z9 x = fsolve(lambda x: angle((Z10 - (Zmid + 1j * x)) / (Z10 - Z9)), -self.R1) Zrad1 = Zmid + 1j * x[0] Zrad2 = Zrad1.conjugate() # We can split in rad only if Zrad1 is between Z10 and Z9 is_rad_splittable = Z10.real < Zrad1.real and Zrad1.real < Z9.real # Creation of curve surf_list = list() if Nrad == 1 and Ntan == 2: if is_simplified: # Part 1 (0,0) line1 = Segment(Z12, Ztan1) line2 = Segment(Ztan1, Ztan2) point_ref = (Z12 + Ztan1 + Ztan2 + Z8 + Z9 + Z10 + Z11) / 7 surface = SurfLine( line_list=[line1, line2], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (0,1) line1 = Segment(Ztan1, Z2) point_ref = (Ztan1 + Z2 + Z3 + Z4 + Z5 + Z6 + Ztan2) / 7 surface = SurfLine(line_list=[line1], label="Wind" + st + "_R0_T1_S0", point_ref=point_ref) surf_list.append(surface) else: # Part 1 (0,0) line1 = Segment(Z12, Ztan1) line2 = Segment(Ztan1, Ztan2) line3 = Arc1(Ztan2, Z8, -abs(Z7)) line4 = Arc1(Z8, Z9, -self.R2) line5 = Segment(Z9, Z10) line6 = Arc1(Z10, Z11, -self.R1) line7 = Segment(Z11, Z12) point_ref = (Z12 + Ztan1 + Ztan2 + Z8 + Z9 + Z10 + Z11) / 7 surface = SurfLine( line_list=[line1, line2, line3, line4, line5, line6, line7], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (0,1) line1 = Segment(Ztan1, Z2) line2 = Segment(Z2, Z3) line3 = Arc1(Z3, Z4, -self.R1) line4 = Segment(Z4, Z5) line5 = Arc1(Z5, Z6, -self.R2) line6 = Arc1(Z6, Ztan2, -abs(Z7)) point_ref = (Ztan1 + Z2 + Z3 + Z4 + Z5 + Z6 + Ztan2) / 7 line7 = Segment(Ztan2, Ztan1) surface = SurfLine( line_list=[line1, line2, line3, line4, line5, line6, line7], label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) elif Nrad == 2 and Ntan == 1 and is_rad_splittable: if is_simplified: # Part 1 (0,0) line1 = Segment(Z12, Z2) line2 = Segment(Zrad1, Zrad2) point_ref = (Z12 + Z2 + Z3 + Z4 + Zrad2 + Zrad1 + Z10 + Z11) / 8 surface = SurfLine( line_list=[line1, line2], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) point_ref = (Zrad1 + Zrad2 + Z5 + Z6 + Z8 + Z9) / 6 surface = SurfLine(line_list=[], label="Wind" + st + "_R1_T0_S0", point_ref=point_ref) surf_list.append(surface) else: # Part 1 (0,0) line1 = Segment(Z12, Z2) line2 = Segment(Z2, Z3) line3 = Arc1(Z3, Z4, -self.R1) line4 = Segment(Z4, Zrad2) line5 = Segment(Zrad2, Zrad1) line6 = Segment(Zrad1, Z10) line7 = Arc1(Z10, Z11, -self.R1) line8 = Segment(Z11, Z12) point_ref = (Z12 + Z2 + Z3 + Z4 + Zrad2 + Zrad1 + Z10 + Z11) / 8 surface = SurfLine( line_list=[ line1, line2, line3, line4, line5, line6, line7, line8 ], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) line1 = Segment(Zrad1, Zrad2) line2 = Segment(Zrad2, Z5) line3 = Arc1(Z5, Z6, -self.R2) line4 = Arc1(Z6, Z8, -abs(Z7)) line5 = Arc1(Z8, Z9, -self.R2) line6 = Segment(Z9, Zrad1) point_ref = (Zrad1 + Zrad2 + Z5 + Z6 + Z8 + Z9) / 6 surface = SurfLine( line_list=[line1, line2, line3, line4, line5, line6, line7], label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) elif Nrad == 2 and Ntan == 2 and is_rad_splittable: if is_simplified: # Part 1 (0,0) line1 = Segment(Z12, Ztan1) line2 = Segment(Ztan1, Zmid) line3 = Segment(Zmid, Zrad1) line4 = Segment(Zrad1, Z10) line5 = Arc1(Z10, Z11, -self.R1) line6 = Segment(Z11, Z12) point_ref = (Z12 + Ztan1 + Zmid + Zrad1 + Z10 + Z11) / 6 surface = SurfLine( line_list=[line1, line2, line3, line4, line5, line6], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) line2 = Segment(Zmid, Ztan2) line3 = Arc1(Ztan2, Z8, -abs(Z7)) line4 = Arc1(Z8, Z9, -self.R2) line5 = Segment(Z9, Zrad1) point_ref = (Zrad1 + Zmid + Ztan2 + Z8 + Z9) / 5 line1 = Segment(Zrad1, Zmid) surface = SurfLine( line_list=[line1, line2, line3, line4, line5], label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 3 (0,1) line1 = Segment(Ztan1, Z2) line2 = Segment(Z2, Z3) line3 = Arc1(Z3, Z4, -self.R1) line4 = Segment(Z4, Zrad2) line5 = Segment(Zrad2, Zmid) line6 = Segment(Zmid, Ztan1) point_ref = (Ztan1 + Z2 + Z3 + Z4 + Zrad2 + Zmid) / 6 surface = SurfLine( line_list=[line1, line2, line3, line4, line5, line6], label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part4 (1,1) line1 = Segment(Zmid, Zrad2) line2 = Segment(Zrad2, Z5) line3 = Arc1(Z5, Z6, -self.R2) line4 = Arc1(Z6, Ztan2, -abs(Z7)) line5 = Segment(Ztan2, Zmid) point_ref = (Zmid + Zrad2 + Z5 + Z6 + Ztan2) / 5 surface = SurfLine( line_list=[line1, line2, line3, line4, line5], label="Wind" + st + "_R1_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Part 1 (0,0) line1 = Segment(Z12, Ztan1) line2 = Segment(Ztan1, Zmid) line3 = Segment(Zmid, Zrad1) line4 = Segment(Zrad1, Z10) line5 = Arc1(Z10, Z11, -self.R1) line6 = Segment(Z11, Z12) point_ref = (Z12 + Ztan1 + Zmid + Zrad1 + Z10 + Z11) / 6 surface = SurfLine( line_list=[line1, line2, line3, line4, line5, line6], label="Wind" + st + "_R0_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part2 (1,0) line2 = Segment(Zmid, Ztan2) line3 = Arc1(Ztan2, Z8, -abs(Z7)) line4 = Arc1(Z8, Z9, -self.R2) line5 = Segment(Z9, Zrad1) point_ref = (Zrad1 + Zmid + Ztan2 + Z8 + Z9) / 5 line1 = Segment(Zrad1, Zmid) surface = SurfLine( line_list=[line1, line2, line3, line4, line5], label="Wind" + st + "_R1_T0_S0", point_ref=point_ref, ) surf_list.append(surface) # Part 3 (0,1) line1 = Segment(Ztan1, Z2) line2 = Segment(Z2, Z3) line3 = Arc1(Z3, Z4, -self.R1) line4 = Segment(Z4, Zrad2) line5 = Segment(Zrad2, Zmid) line6 = Segment(Zmid, Ztan1) point_ref = (Ztan1 + Z2 + Z3 + Z4 + Zrad2 + Zmid) / 6 surface = SurfLine( line_list=[line1, line2, line3, line4, line5, line6], label="Wind" + st + "_R0_T1_S0", point_ref=point_ref, ) surf_list.append(surface) # Part4 (1,1) line1 = Segment(Zmid, Zrad2) line2 = Segment(Zrad2, Z5) line3 = Arc1(Z5, Z6, -self.R2) line4 = Arc1(Z6, Ztan2, -abs(Z7)) line5 = Segment(Ztan2, Zmid) point_ref = (Zmid + Zrad2 + Z5 + Z6 + Ztan2) / 5 surface = SurfLine( line_list=[line1, line2, line3, line4, line5], label="Wind" + st + "_R1_T1_S0", point_ref=point_ref, ) surf_list.append(surface) else: # Default : only one zone curve_list = self.build_geometry() # Remove the isthmus part curve_list = curve_list[1:-1] # Add a line to close the winding area lines = [Segment(curve_list[-1].end, curve_list[0].begin)] lines.extend(curve_list) surface = SurfLine(line_list=lines, label="Wind" + st + "_R0_T0_S0", point_ref=Zmid) surf_list.append(surface) 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 : 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 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 = "S" else: st = "R" 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="Air", 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 S2 = SurfLine( line_list=curve_list_mag, label="Magnet" + st + "_N_R0_T0_S0", 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="Air", 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="Air", 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 S5 = SurfLine( line_list=curve_list_mag, label="Magnet" + st + "_N_R0_T1_S0", 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="Air", 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="Air", 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="Air", 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="Air", 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="Air", 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="Air", 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="Air", 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: surf_list = [S1, S2, S3, S6, S5, S4] elif self.magnet_0 and self.magnet_1 and self.W1 == 0: surf_list = [S1, S2, S7, S5, S4] elif self.magnet_0 and not self.magnet_1 and self.W1 > 0: surf_list = [S1, S2, S3, S9] elif self.magnet_0 and not self.magnet_1 and self.W1 == 0: surf_list = [S1, S2, S10] elif not self.magnet_0 and self.magnet_1 and self.W1 > 0: surf_list = [S8, S6, S5, S4] elif not self.magnet_0 and self.magnet_1 and self.W1 == 0: surf_list = [S11, S5, S4] elif not self.magnet_0 and not self.magnet_1 and self.W1 > 0: surf_list = [S8, S9] elif not self.magnet_0 and not self.magnet_1 and self.W1 == 0: surf_list = [S12] # Apply the transformation for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list
def build_geometry(self, sym=1, alpha=0, delta=0): """Build the geometry of the Frame Parameters ---------- self : Frame Frame Object sym : int symmetry factor (1= full machine, 2= half of the machine...) alpha : float Angle for rotation [rad] delta : complex Complex value for translation Returns ------- surf_list : list list of surface """ surf_list = list() # If there is a frame... if self.comp_height_eq() != 0: if sym == 1: # No symmetry / full frame surf_frame = Circle( radius=self.Rext, label="Frame", center=0, point_ref=self.Rint + (self.Rext - self.Rint) / 2, ) surface = Circle(radius=self.Rint, label=None, center=0, point_ref=0) surf_list.append(surf_frame) surf_list.append(surface) else: # Part of the frame Z0 = self.Rint Z3 = Z0 * exp(1j * 2 * pi / sym) Z1 = self.Rext Z2 = Z1 * exp(1j * 2 * pi / sym) curve_list = list() curve_list.append(Segment(Z0, Z1)) curve_list.append(Arc1(Z1, Z2, self.Rext)) curve_list.append(Segment(Z2, Z3)) curve_list.append(Arc1(Z3, Z0, -self.Rint)) surf_frame = SurfLine( line_list=curve_list, label="Frame", point_ref=self.Rint + (self.Rext - self.Rint) / 2, ) surf_list.append(surf_frame) # Apply the transformations for surf in surf_list: surf.rotate(alpha) surf.translate(delta) return surf_list