示例#1
0
def build_geometry(self):
    """Compute the curve (Line) needed to plot the object.
    The ending point of a curve is the starting point of the next curve
    in the list

    Parameters
    ----------
    self : SlotW11
        A SlotW11 object

    Returns
    -------
    curve_list: list
        A list of 7 Segment and 2 Arc1

    """

    [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, Z10,
     rot_sign] = self._comp_point_coordinate()

    # Creation of curve
    curve_list = list()
    curve_list.append(Segment(Z1, Z2))
    curve_list.append(Segment(Z2, Z3))
    curve_list.append(Segment(Z3, Z4))
    if self.R1 * 2 < self.W2:
        curve_list.append(
            Arc1(Z4,
                 Z5,
                 rot_sign * self.R1,
                 is_trigo_direction=self.is_outwards()))
        curve_list.append(Segment(Z5, Z6))
        curve_list.append(
            Arc1(Z6,
                 Z7,
                 rot_sign * self.R1,
                 is_trigo_direction=self.is_outwards()))
    else:
        curve_list.append(Arc3(Z4, Z7, self.is_outwards()))
    curve_list.append(Segment(Z7, Z8))
    curve_list.append(Segment(Z8, Z9))
    curve_list.append(Segment(Z9, Z10))

    return curve_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
示例#3
0
    "delta": 5 + 10j,
    "exp_center": 5 + 10j
})
translate_test.append({
    "center": -10 - 10j,
    "radius": 10,
    "ref": -10,
    "delta": 0,
    "exp_center": -10 - 10j
})

# Dictionary to test get_lines
lines_test = list()
lines_test.append({"center": 0, "radius": 1, "ref": 0})
lines_test[0]["result"] = [
    Arc3(begin=1, end=-1, is_trigo_direction=True),
    Arc3(begin=-1, end=1, is_trigo_direction=True),
]
lines_test.append({"center": 5 + 5j, "radius": 1, "ref": 4})
lines_test[1]["result"] = [
    Arc3(begin=6 + 5j, end=4 + 5j, is_trigo_direction=True),
    Arc3(begin=4 + 5j, end=6 + 5j, is_trigo_direction=True),
]

# Dictionary to test discretize
disc_test = list()
disc_test.append({"center": 0, "radius": 1, "ref": 0})
disc_test[0]["result"] = exp(1j * linspace(0, 2 * pi, 200, endpoint=False))
disc_test.append({"center": 5 + 5j, "radius": 1, "ref": 4})
disc_test[1]["result"] = exp(
    1j * linspace(0, 2 * pi, 200, endpoint=False)) + 5 + 5j
示例#4
0
def build_geometry(self):
    """Compute the curve (Segment) needed to plot the object.
    The ending point of a curve is the starting point of the next curve in
    the list

    Parameters
    ----------
    self : SlotW26
        A SlotW26 object

    Returns
    -------
    curve_list: list
        A list of 4 Segment and 3 Arc1

    """
    Rbo = self.get_Rbo()

    # alpha is the angle to rotate Z0 so ||Z1,Z8|| = W0
    alpha = float(arcsin(self.W0 / (2 * Rbo)))

    # comp point coordinate (in complex)
    Z0 = Rbo * exp(1j * 0)
    Z1 = Z0 * exp(1j * alpha)

    if self.is_outwards():
        Z2 = Z1 + self.H0
        ZC1 = Z2.real + sqrt(self.R1 ** 2 - (self.W0 / 2.0) ** 2)
        Z3 = ZC1 + self.R1 * 1j
        Z4 = Z3 + self.H1
        rot_sign = 1  # Rotation direction for Arc1
    else:  # inward slot
        Z2 = Z1 - self.H0
        ZC1 = Z2.real - sqrt(self.R1 ** 2 - (self.W0 / 2.0) ** 2)
        Z3 = ZC1 + self.R1 * 1j
        Z4 = Z3 - self.H1
        rot_sign = -1  # Rotation direction for Arc1

    # symetry
    Z5 = Z4.conjugate()
    Z6 = Z3.conjugate()
    Z7 = Z2.conjugate()
    Z8 = Z1.conjugate()

    [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8] = [Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1]

    # Creation of curve
    curve_list = list()
    curve_list.append(Segment(Z1, Z2))
    if self.H1 > 0:
        curve_list.append(Arc1(Z2, Z3, rot_sign * self.R1, self.is_outwards()))
        curve_list.append(Segment(Z3, Z4))
        curve_list.append(Arc3(Z4, Z5, self.is_outwards()))
        curve_list.append(Segment(Z5, Z6))
        curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1, self.is_outwards()))
    elif self.H1 == 0:
        curve_list.append(Arc1(Z2, Z3, rot_sign * self.R1, self.is_outwards()))
        curve_list.append(Arc3(Z3, Z6, self.is_outwards()))
        curve_list.append(Arc1(Z6, Z7, rot_sign * self.R1, self.is_outwards()))
    else:  # Should never be called
        raise (Slot26_H1, "H1 can't be <0")

    curve_list.append(Segment(Z7, Z8))

    return curve_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
示例#6
0
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
示例#7
0
    {
        "arc": Arc2(begin=1 + 1j, center=0, angle=pi / 2),  # Arc to split
        "Z1": -2 + 1j,  # First point of cutting line
        "Z2": 1 + 1j,  # Second point of cutting line
        "center": 0,  # Center of the arc (should not be changed by the split)
        "Zi": [1 + 1j, -1 + 1j],  # Expected intersection points
        "Zs_top": [
            Arc2(begin=1 + 1j, center=0, angle=pi / 2)
        ],  # Expected result for slip is_top
        "Zs_bot": [],  # Expected result for slip not is_top
    }
)
# 28) Arc3, 1 Intersection
split_test.append(
    {
        "arc": Arc3(begin=10, end=-10, is_trigo_direction=True),  # Arc to split
        "Z1": -3j,  # First point of cutting line
        "Z2": 1j,  # Second point of cutting line
        "center": 0,  # Center of the arc (should not be changed by the split)
        "Zi": [10j],  # Expected intersection points
        "Zs_top": [
            Arc1(begin=10j, end=-10, radius=10, is_trigo_direction=True)
        ],  # Expected result for slip is_top
        "Zs_bot": [
            Arc1(begin=10, end=10j, radius=10, is_trigo_direction=True)
        ],  # Expected result for slip not is_top
    }
)
# 29) Case 28 with is_trigo=False
split_test.append(
    {
示例#8
0
def build_geometry(self):
    """Compute the curve (Segment) needed to plot the object.
    The ending point of a curve is the starting point of the next curve in
    the list

    Parameters
    ----------
    self : SlotW26
        A SlotW26 object

    Returns
    -------
    curve_list: list
        A list of 4 Segment and 3 Arc1

    """
    Rbo = self.get_Rbo()

    # getting all point coordinate
    [
        Z1,
        Z2,
        Z3,
        Z4,
        Z5,
        Z6,
        Z7,
        Z8,
        Ztan1,
        Ztan2,
        Zmid,
        Zrad1,
        Zrad2,
        rot_sign,
    ] = self._comp_point_coordinate()

    [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8] = [Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1]

    # Creation of curve
    curve_list = list()
    curve_list.append(Segment(Z1, Z2))
    if self.H1 > 0:
        curve_list.append(
            Arc1(Z2, Z3, rot_sign * self.R1, is_trigo_direction=self.is_outwards())
        )
        curve_list.append(Segment(Z3, Z4))
        curve_list.append(Arc3(Z4, Z5, self.is_outwards()))
        curve_list.append(Segment(Z5, Z6))
        curve_list.append(
            Arc1(Z6, Z7, rot_sign * self.R1, is_trigo_direction=self.is_outwards())
        )
    elif self.H1 == 0:
        curve_list.append(
            Arc1(Z2, Z3, rot_sign * self.R1, is_trigo_direction=self.is_outwards())
        )
        curve_list.append(Arc3(Z3, Z6, self.is_outwards()))
        curve_list.append(
            Arc1(Z6, Z7, rot_sign * self.R1, is_trigo_direction=self.is_outwards())
        )
    else:  # Should never be called
        raise (Slot26_H1, "H1 can't be <0")

    curve_list.append(Segment(Z7, Z8))

    return curve_list
示例#9
0
def get_bore_line(self, alpha1, alpha2, label="", ignore_notches=False):
    """

    Parameters
    ----------
    self : Lamination
        a Lamination object
    alpha1 : float
        Starting angle [rad]
    alpha2 : float
        Ending angle [rad]
    label : str
        the label of the bore line

    Returns
    -------
    bore_line : list
        list of bore line

    """
    delta = alpha2 - alpha1

    if delta == 0:
        return []

    elif delta > 2 * pi:
        raise NotImplementedYetError(
            "Only angle smaller/equal to 2*pi are implemented.")
    else:
        # ignore_notches = 1
        if not self.notch or ignore_notches:
            Rbo = self.get_Rbo()
            Z1 = Rbo * exp(1j * alpha1)
            if delta == 2 * pi:
                Z2 = Rbo * exp(1j * (alpha1 + delta / 2))
                line1 = Arc3(begin=Z1,
                             end=Z2,
                             is_trigo_direction=True,
                             label=label)
                line2 = Arc3(begin=Z2,
                             end=Z1,
                             is_trigo_direction=True,
                             label=label)
                return [line1, line2]
            else:
                Z2 = Rbo * exp(1j * alpha2)
                return [Arc1(begin=Z1, end=Z2, radius=Rbo, label=label)]
        else:
            # === intermediate solution ========================================
            # no check for intersection of different notches
            line_list = self.notch[0].build_geometry(alpha1,
                                                     alpha2,
                                                     label=label)
            # === later =======================================================
            """
            bore_line = self.get_bore_line(alpha1, alpha2, ignore_notches=True)
            for notch in notch_shape:
                notch_line = notch.build_geometry()
                bore_line = build_intersect_geometry(bore_line, notch_line,
                                            inwards=True)
            """

            return line_list