Esempio n. 1
0
def build_geometry(self):
    """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 : SlotW16
        A SlotW16 object

    Returns
    -------
    curve_list: llist
        A list of 4 Segment and 5 Arc

    """

    Rbo = self.get_Rbo()

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

    # Creation of curve
    curve_list = list()
    curve_list.append(Segment(Z1, Z2))
    curve_list.append(Arc1(Z2, Z3, -Rbo + self.H0, is_trigo_direction=False))
    curve_list.append(Arc1(Z3, Z4, -self.R1, is_trigo_direction=False))
    curve_list.append(Segment(Z4, Z5))
    curve_list.append(
        Arc1(Z5, Z6, Rbo - self.H0 - self.H2, is_trigo_direction=True))
    curve_list.append(Segment(Z6, Z7))
    curve_list.append(Arc1(Z7, Z8, -self.R1, is_trigo_direction=False))
    curve_list.append(Arc1(Z8, Z9, -Rbo + self.H0, is_trigo_direction=False))
    curve_list.append(Segment(Z9, Z10))

    return curve_list
Esempio n. 2
0
def build_geometry(self):
    """Compute the curve needed to plot the object.
    The ending point of a curve is the starting point of the next curve in
    the list

    Parameters
    ----------
    self : SlotW25
        A SlotW25 object

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

    """
    [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8] = self._comp_point_coordinate()
    # Creation of curve
    curve_list = list()
    curve_list.append(Segment(Z8, Z7))
    curve_list.append(Arc1(Z7, Z6, -abs(Z2), is_trigo_direction=False))
    curve_list.append(Segment(Z6, Z5))
    curve_list.append(Arc1(Z5, Z4, abs(Z5)))
    curve_list.append(Segment(Z4, Z3))
    curve_list.append(Arc1(Z3, Z2, -abs(Z2), is_trigo_direction=False))
    curve_list.append(Segment(Z2, Z1))
    return curve_list
Esempio n. 3
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 : SlotW28
        A SlotW28 object

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

    """

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

    # Creation of curve
    curve_list = list()
    curve_list.append(Segment(Z1, Z2))
    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()))
    curve_list.append(Segment(Z7, Z8))

    return curve_list
Esempio n. 4
0
def get_lines(self):
    """return the list of lines that delimits the PolarArc

    Parameters
    ----------
    self : PolarArc
        a PolarArc object

    Returns
    -------
    line_list: list
        List of line need to draw the slot (2 Segment + 2 Arc1)
    """
    # check if the PolarArc is correct
    self.check()

    Z_ref = self.point_ref
    center = Z_ref * exp(-1j * angle(Z_ref))
    H = self.height
    A = self.angle
    # the points of the PolarArc
    Z2 = (center - (H / 2)) * exp(1j * (-(A / 2))) * exp(1j * angle(Z_ref))
    Z3 = (center + (H / 2)) * exp(1j * (-(A / 2))) * exp(1j * angle(Z_ref))
    Z4 = (center + (H / 2)) * exp(1j * (A / 2)) * exp(1j * angle(Z_ref))
    Z1 = (center - (H / 2)) * exp(1j * (A / 2)) * exp(1j * angle(Z_ref))

    # Lines that delimit the PolarArc
    line1 = Arc1(Z1, Z2, -abs(Z1))
    line2 = Segment(Z2, Z3)
    line3 = Arc1(Z3, Z4, abs(Z3))
    line4 = Segment(Z4, Z1)

    return [line1, line2, line3, line4]
Esempio n. 5
0
def build_geometry(self):
    """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 : SlotW60
        A SlotW60 object

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

    """

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

    # Creation of curve
    curve_list = list()
    curve_list.append(Arc1(Z1, Z2, self.R1))
    curve_list.append(Segment(Z2, Z3))
    curve_list.append(Segment(Z3, Z4))
    curve_list.append(Segment(Z4, Z5))
    curve_list.append(Segment(Z5, Z6))
    curve_list.append(Segment(Z6, Z7))
    curve_list.append(Segment(Z7, Z8))
    curve_list.append(Segment(Z8, Z9))
    curve_list.append(Segment(Z9, Z10))
    curve_list.append(Arc1(Z10, Z11, self.R1))

    return curve_list
Esempio n. 6
0
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
Esempio n. 7
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 : SlotW23
        A SlotW23 object

    Returns
    -------
    curve_list: list
        A list of 6 Segment and 1 Arc

    """

    [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8] = self._comp_point_coordinate()
    Zc = 0
    # Creation of curve
    curve_list = list()
    curve_list.append(Segment(Z1, Z2))
    curve_list.append(Segment(Z2, Z3))
    curve_list.append(Segment(Z3, Z4))
    curve_list.append(Arc1(Z4, Z5, abs(Z5)))
    curve_list.append(Segment(Z5, Z6))
    curve_list.append(Segment(Z6, Z7))
    curve_list.append(Segment(Z7, Z8))

    return curve_list
Esempio n. 8
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 : Slot19
        A Slot19 object

    Returns
    -------
    curve_list: list
        A list of 2 Segment and 1 Arc

    """

    [Z1, Z2, Z3, Z4] = self._comp_point_coordinate()

    # Creation of curve
    curve_list = list()
    curve_list.append(Segment(Z1, Z2))
    if self.W1 > 0:
        curve_list.append(Arc1(Z2, Z3, abs(Z3)))
    curve_list.append(Segment(Z3, Z4))

    return curve_list
Esempio n. 9
0
 def test_get_middle(self, test_dict):
     """Check that you can compute the arc middle
     """
     arc = Arc1(
         begin=test_dict["begin"],
         end=test_dict["end"],
         radius=test_dict["radius"],
         is_trigo_direction=test_dict["is_trigo"],
     )
     # Check center
     Zc = arc.get_center()
     msg = (
         "Wrong center: return " + str(Zc) + ", expected " + str(test_dict["center"])
     )
     self.assertAlmostEqual(abs(Zc - test_dict["center"]), 0, msg=msg)
     # Check middle
     result = arc.get_middle()
     msg = (
         "Wrong middle: return "
         + str(result)
         + ", expected "
         + str(test_dict["expect"])
     )
     self.assertAlmostEqual(
         abs(result - test_dict["expect"]), 0, delta=1e-6, msg=msg
     )
Esempio n. 10
0
    def test_dicretize(self, test_dict):
        """Check that you can discretize an arc1
        """
        arc = Arc1(
            test_dict["begin"],
            test_dict["end"],
            test_dict["Radius"],
            is_trigo_direction=test_dict["is_trigo"],
        )

        # Check center
        Zc = arc.get_center()
        msg = (
            "Wrong center: return " + str(Zc) + ", expected " + str(test_dict["center"])
        )
        self.assertAlmostEqual(abs(Zc - test_dict["center"]), 0, msg=msg)
        # Check discretize
        result = arc.discretize(test_dict["nb_point"])
        self.assertEqual(result.size, test_dict["result"].size)
        for ii in range(0, result.size):
            a = result[ii]
            b = test_dict["result"][ii]
            msg = (
                "Wrong point["
                + str(ii)
                + "]: return "
                + str(a)
                + ", expected "
                + str(b)
            )
            self.assertAlmostEqual((a - b) / a, 0, delta=DELTA, msg=msg)
Esempio n. 11
0
def get_bore_line(self, alpha1, alpha2, label=""):
    """

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

    Returns
    -------
    bore_line : list
        list of bore line
    
    """
    if alpha1 == alpha2:
        return []
    else:
        Rbo = self.get_Rbo()
        Z1 = Rbo * exp(1j * alpha1)
        Z2 = Rbo * exp(1j * alpha2)
        return [Arc1(begin=Z1, end=Z2, radius=Rbo, label=label)]
Esempio n. 12
0
    def test_get_center(self):
        """Check that the can compute the center of the arc1
        """
        arc = Arc1(begin=1, end=1 * exp(1j * pi / 2), radius=1)
        result = arc.get_center()
        expect = 0
        self.assertAlmostEqual(abs(result - expect), 0)

        arc = Arc1(begin=2 * exp(1j * 3 * pi / 4), end=2 * exp(1j * pi / 4), radius=-2)
        result = arc.get_center()
        expect = 0
        self.assertAlmostEqual(abs(result - expect), 0)

        arc = Arc1(begin=2, end=3, radius=-0.5)
        result = arc.get_center()
        expect = 2.5
        self.assertAlmostEqual(abs(result - expect), 0, delta=1e-3)
Esempio n. 13
0
    def test_comp_length(self, test_dict):
        """Check that you the length return by comp_length is correct
        """
        arc = Arc1(test_dict["begin"], test_dict["end"], test_dict["Radius"])

        a = float(arc.comp_length())
        b = float(test_dict["length"])
        self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)
Esempio n. 14
0
 def test_get_angle(self, test_dict):
     """Check that the arc1 computed angle is correct
     """
     arc = Arc1(begin=test_dict["begin"],
                end=test_dict["end"],
                radius=test_dict["radius"])
     result = arc.get_angle(test_dict["is_deg"])
     self.assertAlmostEqual(result, test_dict["exp_angle"])
Esempio n. 15
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
Esempio n. 16
0
    def test_plot_schematics(self):
        """Check that the schematics is correct
        """
        begin = 1 + 1j
        end = 3 + 2j
        R = 2.5
        # Creating the 4 arcs
        arc_1 = Arc1(begin=begin, end=end, radius=R, is_trigo_direction=True)
        arc_2 = Arc1(begin=begin, end=end, radius=-R, is_trigo_direction=True)
        arc_3 = Arc1(begin=begin, end=end, radius=R, is_trigo_direction=False)
        arc_4 = Arc1(begin=begin, end=end, radius=-R, is_trigo_direction=False)

        plt.close("all")
        fig, axes = plt.subplots()
        axes.set_title("Arc1 Schematics")
        # adding the 4 arcs
        Z = arc_1.discretize(100)
        plt.plot(Z.real, Z.imag, "b")
        Z = arc_2.discretize(100)
        plt.plot(Z.real, Z.imag, "y")
        Z = arc_3.discretize(100)
        plt.plot(Z.real, Z.imag, "r")
        Z = arc_4.discretize(100)
        plt.plot(Z.real, Z.imag, "g")
        # Adding the center
        Zc = arc_1.get_center()
        plt.plot(Zc.real, Zc.imag, "rx")
        plt.text(Zc.real, Zc.imag, "R > 0")
        Zc = arc_2.get_center()
        plt.plot(Zc.real, Zc.imag, "rx")
        plt.text(Zc.real, Zc.imag, "R < 0")
        # Adding begin and end
        plt.text(begin.real, begin.imag, "begin")
        plt.text(end.real, end.imag, "end")
        # Adding legend
        plt.legend(
            ["R > 0, trigo", "R < 0, trigo", "R > 0, not trigo", "R < 0, not trigo"]
        )
        plt.axis("equal")

        plt.plot()
        fig = plt.gcf()
        fig.savefig(join(save_path, "Arc1_schematics.png"))
Esempio n. 17
0
 def test_get_middle(self, test_dict):
     """Check that you can compute the arc middle
     """
     arc = Arc1(begin=test_dict["begin"],
                end=test_dict["end"],
                radius=test_dict["radius"])
     result = arc.get_middle()
     self.assertAlmostEqual(abs(result - test_dict["expect"]),
                            0,
                            delta=1e-6)
Esempio n. 18
0
    def test_translate(self, test_dict):
        """Check that you can translate the arc1
        """
        arc = Arc1(
            begin=test_dict["begin"], end=test_dict["end"], radius=test_dict["radius"]
        )
        expect_radius = arc.radius
        arc.translate(test_dict["delta"])

        self.assertAlmostEqual(abs(arc.begin - test_dict["exp_begin"]), 0, delta=1e-6)
        self.assertAlmostEqual(abs(arc.end - test_dict["exp_end"]), 0, delta=1e-6)
        self.assertAlmostEqual(abs(arc.radius - expect_radius), 0)
Esempio n. 19
0
    def test_dicretize(self, test_dict):
        """Check that you can discretize an arc1
        """
        arc = Arc1(test_dict["begin"], test_dict["end"], test_dict["Radius"])

        result = arc.discretize(test_dict["nb_point"])

        self.assertEqual(result.size, test_dict["result"].size)
        for i in range(0, result.size):
            a = result[i]
            b = test_dict["result"][i]
            self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)
Esempio n. 20
0
def build_geometry(self):
    """Compute the curve (Line) needed to plot the Slot.
    The ending point of a curve is always the starting point of the next
    curve in the list

    Parameters
    ----------
    self : SlotMPolar
        A SlotMPolar object

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

    """

    Rbo = self.get_Rbo()
    alpha = self.comp_angle_opening()
    alpha_mag = self.comp_angle_opening_magnet()

    # Point coordinate for a slot center on Ox
    Z1 = Rbo * exp(-1j * alpha_mag / 2)
    Z2 = Rbo * exp(1j * alpha_mag / 2)
    if self.is_outwards():
        Rbot = Rbo + self.H0
    else:
        Rbot = Rbo - self.H0
    Z3 = Rbot * exp(-1j * alpha_mag / 2)
    Z4 = Rbot * exp(1j * alpha_mag / 2)

    # Curve list of a single slot
    curve_list = list()
    if self.H0 > 0:
        curve_list.append(Segment(Z1, Z3))
    curve_list.append(Arc1(Z3, Z4, Rbot))
    if self.H0 > 0:
        curve_list.append(Segment(Z4, Z2))

    # Complete curve list for all the slots (for one pole)
    slot_list = list()
    for ii in range(len(self.magnet)):
        # Compute angle of the middle of the slot
        beta = -alpha / 2 + alpha_mag / 2 + ii * (self.W3 + alpha_mag)
        # Duplicate and rotate the slot + bore for each slot
        for line in curve_list:
            new_line = type(line)(init_dict=line.as_dict())
            new_line.rotate(beta)
            slot_list.append(new_line)
        if ii != len(self.magnet) - 1:  # Add the W3 except for the last slot
            slot_list.append(Arc2(slot_list[-1].get_end(), 0, self.W3))

    return slot_list
    def test_build_geometry_out(self):
        """check that curve_list is correct (outwards magnet)"""
        lam = LamSlotMag(
            Rint=40e-3,
            Rext=90e-3,
            is_internal=False,
            is_stator=False,
            L1=0.45,
            Nrvd=1,
            Wrvd=0.05,
        )
        magnet = [MagnetType11(Wmag=pi / 10, Hmag=0.2)]
        lam.slot = SlotMPolar(Zs=8, W0=pi / 10, H0=0.2, magnet=magnet)
        test_obj = lam.slot.magnet[0]
        Z1 = (40e-3 + 0.2) * exp(-1j * pi / 10 / 2)
        Z2 = (40e-3 + 0.2) * exp(1j * pi / 10 / 2)

        Z = abs(Z1)

        Z3 = (Z - 0.2) * exp(1j * angle(Z1))
        Z4 = (Z - 0.2) * exp(1j * angle(Z2))

        # # Creation of curve
        curve_list = list()
        curve_list.append(Segment(Z1, Z3))
        curve_list.append(Arc1(Z3, Z4, abs(Z3)))
        curve_list.append(Segment(Z4, Z2))
        curve_list.append(Arc1(Z2, Z1, -abs(Z2)))

        surface = test_obj.build_geometry()
        result = surface[0].get_lines()
        for i in range(0, len(result)):
            a = result[i].begin
            b = curve_list[i].begin
            self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)

            a = result[i].end
            b = curve_list[i].end
            self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)
Esempio n. 22
0
 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)
Esempio n. 23
0
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")
Esempio n. 24
0
 def test_get_angle(self, test_dict):
     """Check that the arc1 computed angle is correct
     """
     arc = Arc1(
         begin=test_dict["begin"],
         end=test_dict["end"],
         radius=test_dict["radius"],
         is_trigo_direction=test_dict["is_trigo"],
     )
     # Check center
     Zc = arc.get_center()
     msg = (
         "Wrong center: return " + str(Zc) + ", expected " + str(test_dict["center"])
     )
     self.assertAlmostEqual(abs(Zc - test_dict["center"]), 0, msg=msg)
     # Check angle
     result = arc.get_angle(test_dict["is_deg"])
     self.assertAlmostEqual(result, test_dict["exp_angle"])
Esempio n. 25
0
    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)
Esempio n. 26
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
Esempio n. 27
0
    def test_comp_length(self, test_dict):
        """Check that you the length return by comp_length is correct
        """
        arc = Arc1(
            begin=test_dict["begin"],
            end=test_dict["end"],
            radius=test_dict["Radius"],
            is_trigo_direction=test_dict["is_trigo"],
        )

        # Check center
        Zc = arc.get_center()
        msg = (
            "Wrong center: return " + str(Zc) + ", expected " + str(test_dict["center"])
        )
        self.assertAlmostEqual(abs(Zc - test_dict["center"]), 0, msg=msg)
        # Check length
        a = float(arc.comp_length())
        b = float(test_dict["length"])
        msg = "Wrong length: returned " + str(a) + ", expected " + str(b)
        self.assertAlmostEqual((a - b) / a, 0, delta=DELTA, msg=msg)
Esempio n. 28
0
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")
Esempio n. 29
0
    def test_split_half(self, test_dict):
        """Check that the arc1 split is correct
        """
        arc = Arc1(
            begin=test_dict["begin"],
            end=test_dict["end"],
            radius=test_dict["radius"],
            is_trigo_direction=test_dict["is_trigo"],
        )

        # Check center
        Zc = arc.get_center()
        msg = (
            "Wrong center: return " + str(Zc) + ", expected " + str(test_dict["center"])
        )
        self.assertAlmostEqual(abs(Zc - test_dict["center"]), 0, msg=msg)
        # Check split
        arc.split_half(is_begin=test_dict["is_begin"])
        self.assertAlmostEqual(arc.begin, test_dict["N_begin"])
        self.assertAlmostEqual(arc.end, test_dict["N_end"])
        self.assertAlmostEqual(arc.radius, test_dict["N_radius"])
        self.assertAlmostEqual(arc.is_trigo_direction, test_dict["is_trigo"])
Esempio n. 30
0
def get_bore_line(self, label=""):
    """Return the bore line description

    Parameters
    ----------
    self : BoreFlower
        A BoreFlower object

    Returns
    -------
    bore_list : list
        List of bore lines
    """

    if self.parent is not None:
        Rbo = self.parent.get_Rbo()
    else:
        raise ParentMissingError("Error: The slot is not inside a Lamination")

    # Compute the shape
    (alpha_lim, z_top_left,
     z_top_right) = comp_flower_arc(2 * pi / self.N, self.Rarc, Rbo)

    # Create the lines
    bore_list = list()
    for ii in range(self.N):
        bore_list.append(
            Arc1(
                begin=z_top_right * exp(1j * (2 * pi / self.N *
                                              (ii - 1) + self.alpha)),
                end=z_top_left * exp(1j * (2 * pi / self.N *
                                           (ii - 1) + self.alpha)),
                radius=self.Rarc,
                is_trigo_direction=True,
                label=label,
            ))
    return bore_list