Пример #1
0
def comp_masses(self):
    """Compute the Lamination masses

    Parameters
    ----------
    self : LamSlotWind
        A LamSlotWind object

    Returns
    -------
    M_dict: dict
        Lamination mass dictionnary (Mtot, Mlam, Mwind) [kg]

    """

    M_dict = LamSlot.comp_masses(self)
    V_dict = self.comp_volumes()
    if self.winding is not None:
        Mwind = V_dict["Vwind"] * self.winding.mat_type.struct.rho
    else:
        Mwind = 0

    M_dict["Mtot"] += Mwind
    M_dict["Mwind"] = Mwind

    return M_dict
Пример #2
0
    def test_build_geometry(self):
        """Check if the curve_list is correct"""
        test_obj = SlotW27(
            Zs=6, H0=0.05, W0=30e-3, H1=0.125, W1=0.06, H2=0.05, W2=0.09, W3=0.04
        )
        lam = LamSlot(is_internal=False, slot=test_obj, Rint=1)

        Z1 = exp(1j * float(arcsin(30e-3 / 2.0)))
        Z2 = Z1 + 0.05
        Z3 = Z2 + ((0.06 - 30e-3) / 2.0) * 1j
        Z4 = Z3 + 0.125 + ((0.09 - 0.06) / 2.0) * 1j
        Z5 = Z4 + 0.05 + ((0.04 - 0.09) / 2.0) * 1j
        Z6 = Z5.conjugate()
        Z7 = Z4.conjugate()
        Z8 = Z3.conjugate()
        Z9 = Z2.conjugate()
        Z10 = Z1.conjugate()

        [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, Z10] = [
            Z10,
            Z9,
            Z8,
            Z7,
            Z6,
            Z5,
            Z4,
            Z3,
            Z2,
            Z1,
        ]
        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, 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))

        result = test_obj.build_geometry()
        self.assertEqual(len(result), len(curve_list))
        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)
Пример #3
0
    def test_build_geometry(self):
        """check that curve_list is correct"""
        test_obj = SlotW22(W0=pi / 10, H0=0.1, W2=pi / 5, H2=0.1)
        lam = LamSlot(is_internal=False, slot=test_obj, Rint=1)

        Z1 = cos(pi / 20) + 1j * sin(pi / 20)
        Z2 = 1.1 * (cos(pi / 20) + 1j * sin(pi / 20))
        Z3 = 1.1 * (cos(pi / 10) + 1j * sin(pi / 10))
        Z4 = 1.2 * (cos(pi / 10) + 1j * sin(pi / 10))
        Z5 = 1.2 * (cos(pi / 10) - 1j * sin(pi / 10))
        Z6 = 1.1 * (cos(pi / 10) - 1j * sin(pi / 10))
        Z7 = 1.1 * (cos(pi / 20) - 1j * sin(pi / 20))
        Z8 = cos(pi / 20) - 1j * sin(pi / 20)
        [Z8, Z7, Z6, Z5, Z4, Z3, Z2, Z1] = [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8]

        # Creation of curve
        curve_list = list()
        Zc = 0  # center
        curve_list.append(Segment(Z1, Z2))
        curve_list.append(Arc2(Z2, Zc, -pi / 20))
        curve_list.append(Segment(Z3, Z4))
        curve_list.append(Arc2(Z4, Zc, pi / 5))
        curve_list.append(Segment(Z5, Z6))
        curve_list.append(Arc2(Z6, Zc, -pi / 20))
        curve_list.append(Segment(Z7, Z8))

        result = test_obj.build_geometry()
        self.assertEqual(len(result), len(curve_list))
        for i in range(0, len(result)):
            if isinstance(result[i], Segment):
                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)
            else:  # Arc2
                a = result[i].begin
                b = curve_list[i].begin
                self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)

                a = result[i].center
                b = curve_list[i].center
                self.assertAlmostEqual(a, b)

                a = result[i].angle
                b = curve_list[i].angle
                self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)
Пример #4
0
    def test_build_geometry(self):
        """check that curve_list is correct"""
        test_obj = SlotW10(W0=0.2,
                           H0=0.1,
                           W1=0.4,
                           H1=0.1,
                           H1_is_rad=False,
                           H2=0.1,
                           W2=0.6)
        lam = LamSlot(is_internal=False, slot=test_obj, Rint=1)

        # Rbo=1
        Z10 = exp(1j * float(arcsin(0.1)))
        Z9 = Z10 + 0.1
        Z8 = Z10 + 0.1j + 0.2
        Z7 = Z10 + 0.2
        Z6 = Z10 + 0.2j + 0.3
        Z5 = Z10 - 0.4j + 0.3
        Z4 = Z10 - 0.2j + 0.2
        Z3 = Z10 - 0.3j + 0.2
        Z2 = Z10 - 0.2j + 0.1
        Z1 = Z10 - 0.2j

        # 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(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))

        result = test_obj.build_geometry()
        self.assertEqual(len(result), len(curve_list))
        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)
Пример #5
0
def comp_surfaces(self):
    """Compute the Lamination surfaces (Slam, Svent, Sslot, Swind)

    Parameters
    ----------
    self : LamSlotWind
        A LamSlotWind object

    Returns
    -------
    S_dict: dict
        Lamination surface dictionnary (Slam, Svent, Sslot, Swind) [m**2]

    """

    S_dict = LamSlot.comp_surfaces(self)

    S_dict["Swind"] = self.slot.Zs * self.slot.comp_surface_wind()

    return S_dict
Пример #6
0
def comp_volumes(self):
    """Compute the Lamination volumes (Vlam, Vvent, Vslot, Vwind)

    Parameters
    ----------
    self : LamSlotWind
        A LamSlotWind object

    Returns
    -------
    V_dict: dict
        Lamination volume dictionnary (Vlam, Vvent, Vslot, Vwind) [m**3]

    """

    V_dict = LamSlot.comp_volumes(self)
    Lf = self.comp_length()  # Include radial ventilation ducts
    V_dict["Vwind"] = Lf * self.slot.Zs * self.slot.comp_surface_wind()

    return V_dict
Пример #7
0
def comp_surfaces(self):
    """Compute the Lamination surfaces (Slam, Svent, Sslot, Smag)

    Parameters
    ----------
    self : LamSlotMag
        A LamSlotMag object

    Returns
    -------
    S_dict: dict
        Lamination surface dictionnary (Slam, Svent, Sslot, Smag) [m**2]

    """

    S_dict = LamSlot.comp_surfaces(self)
    Smag = 0
    for magnet in self.slot.magnet:
        Smag += magnet.comp_surface()

    S_dict["Smag"] = Smag

    return S_dict
Пример #8
0
def comp_volumes(self):
    """Compute the Lamination volumes (Vlam, Vvent, Vslot, Vmag)

    Parameters
    ----------
    self : LamSlotMag
        A LamSlotMag object

    Returns
    -------
    V_dict: dict
        Lamination surface dictionnary (Vlam, Vvent, Vslot, Vmag) [m**3]

    """

    V_dict = LamSlot.comp_volumes(self)
    Vmag = 0
    for magnet in self.slot.magnet:
        Vmag += magnet.comp_volume()

    V_dict["Vmag"] = Vmag

    return V_dict
Пример #9
0
def comp_surfaces(self):
    """Compute the Lamination surfaces (Slam, Svent, Sslot, Swind)

    Parameters
    ----------
    self : LamSlotWind
        A LamSlotWind object

    Returns
    -------
    S_dict: dict
        Lamination surface dictionnary (Slam, Svent, Sslot, Swind) [m**2]

    """

    S_dict = LamSlot.comp_surfaces(self)

    if self.slot is not None:
        S_dict["Swind"] = self.get_Zs() * self.slot.comp_surface_wind()
    else:
        S_dict["Swind"] = 0

    return S_dict
Пример #10
0
    def test_build_geometry(self):
        """Check if the build_geometry of the slot is correct
        """
        test_obj = SlotW12(H0=1e-3, H1=6e-3, R1=0.5e-3, R2=2e-3)
        lam = LamSlot(is_internal=True, slot=test_obj, Rext=1)

        # Rbo = 1
        Z1 = exp(-1j * float(arcsin(2e-3)))
        Z2 = Z1 - 1e-3
        Z3 = Z2 - 1e-3
        Z4 = Z3 - 6e-3
        # symetry
        Z5 = Z4.conjugate()
        Z6 = Z3.conjugate()
        Z7 = Z2.conjugate()
        Z8 = Z1.conjugate()

        # creation of the curve
        curve_list = list()
        curve_list.append(Segment(Z1, Z2))
        curve_list.append(Arc3(Z2, Z3, True))
        curve_list.append(Segment(Z3, Z4))
        curve_list.append(Arc3(Z4, Z5, True))
        curve_list.append(Segment(Z5, Z6))
        curve_list.append(Arc3(Z6, Z7, True))
        curve_list.append(Segment(Z7, Z8))

        result = test_obj.build_geometry()
        self.assertEqual(len(result), len(curve_list))
        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)
Пример #11
0
def comp_masses(self):
    """Compute the Lamination masses (Mlam, Mmag)

    Parameters
    ----------
    self : LamSlotMag
        A LamSlotMag object

    Returns
    -------
    M_dict: dict
        Lamination mass dictionnary (Mtot, Mlam, Mmag) [kg]

    """

    M_dict = LamSlot.comp_masses(self)
    Mmag = 0
    for magnet in self.slot.magnet:
        Mmag += magnet.comp_mass()

    M_dict["Mmag"] = Mmag
    M_dict["Mtot"] += Mmag

    return M_dict
Пример #12
0
from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.SurfLine import SurfLine
from pyleecan.Classes.Arc1 import Arc1
from pyleecan.Classes.Arc3 import Arc3
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW12_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW12(H0=1e-3, H1=6e-3, R1=0.5e-3, R2=2e-3)
slotW12_test.append(
    {
        "test_obj": lam,
        "S_exp": 3.91088e-5,
        "Aw": 0.0299276,
        "SW_exp": 3.028318e-5,
        "H_exp": 1.0015e-2,
    }
)

# Outward Slot
lam = LamSlot(is_internal=False, Rint=0.1325)
lam.slot = SlotW12(H0=1e-3, H1=6e-3, R1=0.5e-3, R2=2e-3)
slotW12_test.append(
Пример #13
0
from pyleecan.Classes.SlotW29 import SlotW29
from numpy import ndarray, arcsin, exp
from pyleecan.Classes.LamSlot import LamSlot
from ddt import ddt, data
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW29_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW29(H0=1e-3, H1=1.5e-3, H2=30e-3, W0=12e-3, W1=14e-3, W2=20e-3)
slotW29_test.append({
    "test_obj": lam,
    "S_exp": 6.340874e-4,
    "Ao": 0.10004,
    "Aw": 0.174118,
    "SW_exp": 6e-4,
    "H_exp": 3.26359e-2,
})

# External Slot
lam = LamSlot(is_internal=False, Rint=0.1325)
lam.slot = SlotW29(H0=1e-3, H1=1.5e-3, H2=30e-3, W0=12e-3, W1=14e-3, W2=20e-3)
slotW29_test.append({
    "test_obj": lam,
Пример #14
0
    def test_build_geometry_wind(self):
        """Check if the build_geometry_wind works correctly
        """

        test_obj = SlotW12(H0=1e-3, H1=6e-3, R1=0.5e-3, R2=2e-3)
        lam = LamSlot(is_internal=True, slot=test_obj, Rext=1)

        # Rbo = 1
        Z1 = exp(-1j * float(arcsin(2e-3)))
        Z2 = Z1 - 1e-3
        Z3 = Z2 - 1e-3
        Z4 = Z3 - 6e-3
        # symetry
        Z5 = Z4.conjugate()
        Z6 = Z3.conjugate()
        Z7 = Z2.conjugate()
        Z8 = Z1.conjugate()

        Ztan1 = Z3.real
        Ztan2 = Z4.real - 2e-3

        Zrad2 = Z6 - (6e-3 + 2e-3) / 2
        Zrad1 = Z3 - (6e-3 + 2e-3) / 2

        Zmid = (Ztan1 + Ztan2) / 2

        expected = list()

        # part(0,0)
        curve_list = list()
        curve_list.append(Segment(Z3, Ztan1))
        curve_list.append(Segment(Ztan1, Zmid))
        curve_list.append(Segment(Zmid, Zrad1))
        curve_list.append(Segment(Zrad1, Z3))
        point_ref = (Z3 + Ztan1 + Zmid + Zrad1) / 4
        surface = SurfLine(
            line_list=curve_list, point_ref=point_ref, label="WindS_R0_T0_S0"
        )
        expected.append(surface)

        # part (1,0)
        curve_list = list()
        curve_list.append(Segment(Zrad1, Zmid))
        curve_list.append(Segment(Zmid, Ztan2))
        curve_list.append(Arc1(Ztan2, Z4, 2e-3))
        curve_list.append(Segment(Z4, Zrad1))
        point_ref = (Z4 + Ztan2 + Zmid + Zrad1) / 4
        surface = SurfLine(
            line_list=curve_list, point_ref=point_ref, label="WindS_R1_T0_S0"
        )
        expected.append(surface)

        # part(0, 1)

        curve_list = list()
        curve_list.append(Segment(Ztan1, Z6))
        curve_list.append(Segment(Z6, Zrad2))
        curve_list.append(Segment(Zrad2, Zmid))
        curve_list.append(Segment(Zmid, Ztan1))
        point_ref = (Z6 + Ztan1 + Zmid + Zrad2) / 4
        surface = SurfLine(
            line_list=curve_list, point_ref=point_ref, label="WindS_R0_T1_S0"
        )
        expected.append(surface)

        # part(1, 1)
        curve_list = list()
        curve_list.append(Segment(Zmid, Zrad2))
        curve_list.append(Segment(Zrad2, Z5))
        curve_list.append(Arc1(Z5, Ztan2, 2e-3))
        curve_list.append(Segment(Ztan2, Zmid))
        point_ref = (Z5 + Ztan2 + Zmid + Zrad2) / 4
        surface = SurfLine(
            line_list=curve_list, point_ref=point_ref, label="WindS_R1_T1_S0"
        )
        expected.append(surface)

        result = test_obj.build_geometry_wind(Nrad=2, Ntan=2)
        self.assertEqual(len(result), len(expected))
        for i in range(0, len(result)):
            self.assertEqual(len(result[i].line_list), len(expected[i].line_list))
            for jj in range(len(result[i].line_list)):
                a = result[i].line_list[jj].begin
                b = expected[i].line_list[jj].begin
                self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)

                a = result[i].line_list[jj].end
                b = expected[i].line_list[jj].end
                self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)

            self.assertTrue(result[i].label == expected[i].label)
Пример #15
0
    def test_christmas(self):
        """Test User Defined slot "snowflake"
        """

        plt.close("all")
        Rrotor = abs(0.205917893677990 - 0.107339745962156j)
        test_obj = MachineSRM()
        # Stator definintion
        test_obj.stator = LamSlotWind(Rint=Rrotor + 5e-3,
                                      Rext=Rrotor + 120e-3,
                                      is_internal=False,
                                      is_stator=True)
        test_obj.stator.slot = SlotW21(Zs=36,
                                       W0=7e-3,
                                       H0=10e-3,
                                       H1=0,
                                       H2=70e-3,
                                       W1=30e-3,
                                       W2=0.1e-3)
        test_obj.stator.winding = WindingDW2L(qs=3, p=3, coil_pitch=5)

        # Rotor definition
        test_obj.rotor = LamSlot(Rint=0.02,
                                 Rext=Rrotor,
                                 is_internal=True,
                                 is_stator=False)
        test_obj.rotor.axial_vent = [
            VentilationTrap(Zh=6,
                            Alpha0=0,
                            D0=0.025,
                            H0=0.025,
                            W1=0.015,
                            W2=0.04)
        ]
        # Complex coordinates of the snowflake slot
        point_list = [
            0.205917893677990 - 0.107339745962156j,
            0.187731360198517 - 0.0968397459621556j,
            0.203257639640145 - 0.0919474411167423j,
            0.199329436409870 - 0.0827512886940357j,
            0.174740979141750 - 0.0893397459621556j,
            0.143564064605510 - 0.0713397459621556j,
            0.176848674296337 - 0.0616891108675446j,
            0.172822394854708 - 0.0466628314259158j,
            0.146001886779019 - 0.0531173140978201j,
            0.155501886779019 - 0.0366628314259158j,
            0.145109581933606 - 0.0306628314259158j,
            0.127109581933606 - 0.0618397459621556j,
            0.0916025403784439 - 0.0413397459621556j,
            0.134949327895761 - 0.0282609076372691j,
            0.129324972242779 - 0.0100025773880714j,
            0.0690858798800485 - 0.0283397459621556j,
            0.0569615242270663 - 0.0213397459621556j,
        ]
        test_obj.rotor.slot = SlotUD(Zs=6, is_sym=True, point_list=point_list)

        # Plot, check and save
        test_obj.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 83)
        fig.savefig(join(save_path, "test_Christmas.png"))
Пример #16
0
machine8.rotor.is_stator = False

machine9 = MachineWRSM()
machine9.stator = LamSlotWind()
machine9.stator.winding = WindingDW2L()
machine9.rotor = LamSlotWind()
machine9.rotor.winding = WindingCW2LT()
machine9._set_None()  # Empty machine
machine9.type_machine = 9
machine9.stator.is_stator = True
machine9.rotor.is_stator = False

machine10 = MachineSRM()
machine10.stator = LamSlotWind()
machine10.stator.winding = WindingDW2L()
machine10.rotor = LamSlot()
machine10._set_None()  # Empty machine
machine10.type_machine = 10
machine10.stator.is_stator = True
machine10.rotor.is_stator = False

# Dictionnary with all the information to set a SCIM
SCIM_dict = {
    "machine_type": MachineSCIM,
    "init_machine": machine1,
    "start_step": S_step,
    "stator_step": LSW_step,
    "rotor_step": LSC_step,
    "name": "SCIM",
    "img": pixmap_dict["SCIM"],
    "txt": "SCIM (Squirrel Cage Induction Machine) is type_machine = 1",
Пример #17
0
from pyleecan.Classes.SlotW22 import SlotW22
from numpy import pi, ndarray, cos, sin
from pyleecan.Classes.LamSlot import LamSlot
from ddt import ddt, data
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW22_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=1)
lam.slot = SlotW22(Zs=36, W0=pi / 72, W2=pi / 36, H0=6e-3, H2=40e-3)
slotW22_test.append({
    "test_obj": lam,
    "S_exp": 3.660915e-03,
    "SW_exp": 3.3999e-03,
    "H_exp": 0.046
})

# External Slot
lam = LamSlot(is_internal=False, Rint=1)
lam.slot = SlotW22(Zs=36, W0=pi / 72, W2=pi / 36, H0=6e-3, H2=40e-3)
slotW22_test.append({
    "test_obj": lam,
    "S_exp": 3.844e-03,
    "SW_exp": 3.5814e-03,
Пример #18
0
from pyleecan.Classes.SlotW13 import SlotW13
from numpy import ndarray, arcsin, pi
from pyleecan.Classes.LamSlot import LamSlot
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW13_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW13(H0=5e-3,
                   H1=10e-3,
                   H2=30e-3,
                   W0=10e-3,
                   W1=14e-3,
                   W2=8e-3,
                   W3=20e-3,
                   H1_is_rad=False)
slotW13_test.append({
    "test_obj": lam,
    "S_exp": 5.906291e-4,
    "Aw": 0.13671123,
    "SW_exp": 4.2e-4,
    "H_exp": 0.04509437,
})
Пример #19
0
from ddt import ddt, data
from numpy import pi

from pyleecan.Classes.LamSlot import LamSlot
from pyleecan.Classes.SlotW60 import SlotW60
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening

# For AlmostEqual
DELTA = 1e-5

SlotW60_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW60(Zs=12,
                   W1=25e-3,
                   W2=12.5e-3,
                   H1=20e-3,
                   H2=20e-3,
                   R1=0.1,
                   H3=0,
                   H4=0,
                   W3=0)
SlotW60_test.append({
    "test_obj": lam,
    "S_exp": 1.5792e-3,
    "Aw": 0.119451,
    "SW_exp": 2.5e-4,
    "H_exp": 0.0405716,
Пример #20
0
from pyleecan.Classes.SlotW25 import SlotW25
from numpy import ndarray
from pyleecan.Classes.LamSlot import LamSlot
from ddt import ddt, data
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW25_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW25(Zs=10, H1=3e-3, H2=30e-3, W3=20e-3, W4=40e-3)
slotW25_test.append(
    {
        "test_obj": lam,
        "S_exp": 0.001678213,
        "Ao": 0.32527,
        "Aw": 0.45157,
        "SW_exp": 0.0015532047,
        "H_exp": 0.032848,
    }
)

# External Slot
lam = LamSlot(is_internal=False, Rint=0.1325)
lam.slot = SlotW25(Zs=10, H1=3e-3, H2=30e-3, W3=20e-3, W4=40e-3)
Пример #21
0
from pyleecan.Classes.SlotW26 import SlotW26
from numpy import ndarray
from pyleecan.Classes.LamSlot import LamSlot
from ddt import ddt, data
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW26_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1)
lam.slot = SlotW26(Zs=12, H0=10e-3, W0=10e-3, H1=0.025, R1=0.01, R2=0.0075)
slotW26_test.append({
    "test_obj": lam,
    "S_exp": 7.7471e-4,
    "Ao": 0.10004,
    "Aw": 0.2362668,
    "SW_exp": 6.7387e-4,
    "H_exp": 5.1285e-2,
})

# External Slot
lam = LamSlot(is_internal=False, Rint=0.1)
lam.slot = SlotW26(Zs=12, H0=10e-3, W0=10e-3, H1=0.025, R1=0.01, R2=0.0075)
slotW26_test.append({
    "test_obj": lam,
Пример #22
0
from pyleecan.Classes.SlotW21 import SlotW21
from pyleecan.Classes.LamSlot import LamSlot
from numpy import ndarray, pi, arcsin, exp
from ddt import ddt, data
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW21_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1)
lam.slot = SlotW21(Zs=36,
                   H0=3e-3,
                   H1=0,
                   H1_is_rad=False,
                   H2=20e-3,
                   W0=3e-3,
                   W1=13e-3,
                   W2=10e-3)
slotW21_test.append({
    "test_obj": lam,
    "S_exp": 2.390225015189331e-4,
    "Aw": 0.132201,
    "SW_exp": 2.3e-4,
    "H_exp": 2.3011250632883697e-2,
})
Пример #23
0
    def test_build_geometry_wind(self):
        """Check if the build geometry of the winding works correctly"""
        test_obj = SlotW21(W0=0.2,
                           H0=0.1,
                           W1=0.4,
                           H1=0.1,
                           H1_is_rad=False,
                           H2=0.1,
                           W2=0.6)
        lam = LamSlot(is_internal=False, slot=test_obj, Rint=1)
        # Rbo=1
        Z1 = exp(1j * float(arcsin(0.1)))

        Z2 = Z1 + 0.1
        Z3 = Z1 + 0.1j + 0.2
        Z4 = Z1 + 0.2j + 0.3
        Z5 = Z1 - 0.4j + 0.3
        Z6 = Z1 - 0.3j + 0.2
        Z7 = Z1 - 0.2j + 0.1
        Z8 = Z1 - 0.2j

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

        Ztan1 = (Z3 + Z6) / 2
        Ztan2 = Ztan1 + 0.1

        expected = list()

        # part(0, 0)
        curve_list = list()
        curve_list.append(Segment(Z3, Ztan1))
        curve_list.append(Segment(Ztan1, Ztan2))
        curve_list.append(Segment(Ztan2, Z4))
        curve_list.append(Segment(Z4, Z3))
        point_ref = (Z3 + Ztan1 + Ztan2 + Z4) / 4
        surface = SurfLine(line_list=curve_list,
                           point_ref=point_ref,
                           label="WindS_R0_T0_S0")
        expected.append(surface)

        # part(0, 1)
        curve_list = list()
        curve_list.append(Segment(Ztan1, Z6))
        curve_list.append(Segment(Z6, Z5))
        curve_list.append(Segment(Z5, Ztan2))
        curve_list.append(Segment(Ztan2, Ztan1))
        point_ref = (Z5 + Ztan1 + Ztan2 + Z6) / 4
        surface = SurfLine(line_list=curve_list,
                           point_ref=point_ref,
                           label="WindS_R0_T1_S0")
        expected.append(surface)

        result = test_obj.build_geometry_wind(Nrad=1, Ntan=2)
        self.assertEqual(len(result), len(expected))
        for i in range(0, len(result)):
            self.assertEqual(len(result[i].line_list),
                             len(expected[i].line_list))
            for jj in range(len(result[i].line_list)):
                a = result[i].line_list[jj].begin
                b = expected[i].line_list[jj].begin
                self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)

                a = result[i].line_list[jj].end
                b = expected[i].line_list[jj].end
                self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)

            self.assertTrue(result[i].label == expected[i].label)
Пример #24
0
from pyleecan.Classes.SlotW16 import SlotW16
from numpy import ndarray, arcsin, pi
from pyleecan.Classes.LamSlot import LamSlot
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

SlotW16_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW16(Zs=8, H0=5e-3, H2=30e-3, R1=5e-3, W0=pi / 12, W3=10e-3)
SlotW16_test.append({
    "test_obj": lam,
    "S_exp": 2.508259e-3,
    "Aw": 0.6927673,
    "SW_exp": 2.33808e-3,
    "H_exp": 3.5e-2,
})


@ddt
class test_SlotW16_meth(TestCase):
    """unittest for SlotW16 methods"""
    @data(*SlotW16_test)
    def test_comp_surface(self, test_dict):
Пример #25
0
    def test_build_geometry(self):
        """check that curve_list is correct"""
        test_obj = LamSlot(is_internal=False, Rint=1)
        test_obj.slot = SlotW29(W0=0.2, H0=0.1, W1=0.4, H1=0.1, H2=0.6, W2=0.6)

        # Rbo=1
        Z1 = exp(1j * float(arcsin(0.1)))

        Z2 = Z1 + 0.1
        Z3 = Z1 + 0.1 + 0.1j
        Z4 = Z1 + 0.2 + 0.1j
        Z5 = Z1 + 0.2 + 0.2j
        Z6 = Z1 + 0.8 + 0.2j
        Z7 = Z1 + 0.8 - 0.4j
        Z8 = Z1 + 0.2 - 0.4j
        Z9 = Z1 + 0.2 - 0.3j
        Z10 = Z1 + 0.1 - 0.3j
        Z11 = Z1 + 0.1 - 0.2j
        Z12 = Z1 - 0.2j

        [Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, Z10, Z11, Z12] = [
            Z12,
            Z11,
            Z10,
            Z9,
            Z8,
            Z7,
            Z6,
            Z5,
            Z4,
            Z3,
            Z2,
            Z1,
        ]
        # 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(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(Segment(Z10, Z11))
        curve_list.append(Segment(Z11, Z12))

        result = test_obj.slot.build_geometry()
        self.assertEqual(len(result), len(curve_list))
        for i in range(0, len(result)):
            a = result[i].begin
            b = curve_list[i].begin
            self.assertAlmostEqual(
                (a - b) / a,
                0,
                delta=DELTA,
                msg="Wrong build_geo (for begin point " + str(i) +
                " returned " + str(a) + ", expected " + str(b) + ")",
            )

            a = result[i].end
            b = curve_list[i].end
            self.assertAlmostEqual(
                (a - b) / a,
                0,
                delta=DELTA,
                msg="Wrong build_geo (for end point " + str(i) + " returned " +
                str(a) + ", expected " + str(b) + ")",
            )
Пример #26
0
from pyleecan.Classes.SlotW24 import SlotW24
from numpy import ndarray
from pyleecan.Classes.LamSlot import LamSlot
from ddt import ddt, data
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW24_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW24(Zs=6, H2=30e-3, W3=12e-3)
slotW24_test.append(
    {
        "test_obj": lam,
        "S_exp": 3.33105250485e-3,
        "Ao": 0.9566,
        "Aw": 0.94497,
        "SW_exp": 3.33105e-3,
        "H_exp": 0.03,
    }
)

# External Slot
lam = LamSlot(is_internal=False, Rint=0.1325)
lam.slot = SlotW24(Zs=6, H2=30e-3, W3=12e-3)
Пример #27
0
from pyleecan.Classes.SlotW15 import SlotW15
from numpy import ndarray, arcsin
from pyleecan.Classes.LamSlot import LamSlot
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

SlotW15_test = list()

# Outward Slot
lam = LamSlot(is_internal=False, Rint=0.1325)
lam.slot = SlotW15(H0=5e-3,
                   H1=5e-3,
                   H2=20e-3,
                   R1=4.5e-3,
                   R2=4e-3,
                   W0=5e-3,
                   W3=10e-3)
SlotW15_test.append({
    "test_obj": lam,
    "S_exp": 4.1010919e-4,
    "Aw": 0.10268530,
    "SW_exp": 3.8506988e-4,
    "H_exp": 0.03,
})
Пример #28
0
from pyleecan.Classes.SlotW14 import SlotW14
from numpy import ndarray, arcsin
from pyleecan.Classes.LamSlot import LamSlot
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

SlotW14_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW14(H0=5e-3, H1=5e-3, H3=25e-3, W0=5e-3, W3=10e-3)
SlotW14_test.append({
    "test_obj": lam,
    "S_exp": 2.9443933e-4,
    "Aw": 0.08445503,
    "SW_exp": 2.28378e-4,
    "H_exp": 0.03486507,
})

# Outward Slot
lam = LamSlot(is_internal=False, Rint=0.1325)
lam.slot = SlotW14(H0=5e-3, H1=5e-3, H3=25e-3, W0=5e-3, W3=10e-3)
SlotW14_test.append({
    "test_obj": lam,
    "S_exp": 5.0790294e-4,
Пример #29
0
from pyleecan.Classes.SlotW23 import SlotW23
from numpy import ndarray, arcsin, pi
from pyleecan.Classes.LamSlot import LamSlot
from ddt import ddt, data
from pyleecan.Methods.Slot.Slot.comp_height import comp_height
from pyleecan.Methods.Slot.Slot.comp_surface import comp_surface
from pyleecan.Methods.Slot.Slot.comp_angle_opening import comp_angle_opening
from pyleecan.Methods.Slot.SlotWind.comp_surface_wind import comp_surface_wind

# For AlmostEqual
DELTA = 1e-4

slotW23_test = list()

# Internal Slot
lam = LamSlot(is_internal=True, Rext=0.1325)
lam.slot = SlotW23(H0=1e-3,
                   H1=1.5e-3,
                   H1_is_rad=False,
                   H2=30e-3,
                   W0=12e-3,
                   W1=14e-3,
                   W2=12e-3)
slotW23_test.append({
    "test_obj": lam,
    "S_exp": 4.2080459e-4,
    "Aw": 0.112537,
    "SW_exp": 3.8834260e-04,
    "H_exp": 0.032438,
})
Пример #30
0
    def test_build_geometry_wind(self):
        """Check if the winding surface is correct"""
        test_obj = SlotW11(H0=1e-3,
                           H1=1.5e-3,
                           H2=30e-3,
                           W0=12e-3,
                           W1=14e-3,
                           W2=12e-3,
                           R1=5e-3)

        lam = LamSlot(is_internal=False, slot=test_obj, Rint=1, is_stator=True)
        Z1 = exp(1j * (float(arcsin(12e-3 / 2.0))))
        Z2 = Z1 + 1e-3
        Z3 = Z2 + 1.5e-3 + (14e-3 - 12e-3) * 1j / 2.0
        Z4 = Z3 + (30e-3 - 5e-3) + (12e-3 - 14e-3) / 2.0 * 1j
        Z5 = Z4 + 5e-3 - 5e-3 * 1j
        Z6 = Z5.conjugate()
        Z7 = Z4.conjugate()
        Z8 = Z3.conjugate()
        Ztan1 = (Z3 + Z8) / 2.0
        Ztan2 = (Z5 + Z6) / 2.0
        Zmid = (Ztan1 + Ztan2) / 2.0
        x = fsolve(lambda x: angle((Z7 - (Zmid + 1j * x)) / (Z7 - Z8)),
                   -(12e-3 + 14e-3) / 4.0)
        st = "S"
        Zrad1 = Zmid + 1j * x[0]
        Zrad2 = Zrad1.conjugate()
        expected = list()
        # 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)
        expected.append(surface)
        # Part2 (1,0)
        curve_list = list()
        curve_list.append(Segment(Zrad1, Zmid))
        curve_list.append(Segment(Zmid, Ztan2))
        curve_list.append(Segment(Ztan2, Z6))
        curve_list.append(Arc1(Z6, Z7, -1 * 5e-3))
        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)
        expected.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)
        expected.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, -1 * 5e-3))
        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)
        expected.append(surface)
        result = test_obj.build_geometry_wind(Nrad=2, Ntan=2)
        self.assertEqual(len(result), len(expected))
        for i in range(0, len(result)):
            for jj in range(len(result[i].line_list)):
                a = result[i].line_list[jj].begin
                b = expected[i].line_list[jj].begin
                self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)

                a = result[i].line_list[jj].end
                b = expected[i].line_list[jj].end
                self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)

            self.assertTrue(result[i].label == expected[i].label)