Пример #1
0
    def test_Lam_Mag_10_surface(self):
        """Test machine plot with Magnet 10 surface"""

        plt.close("all")
        rotor = LamSlotMag(
            Rint=40e-3,
            Rext=200e-3,
            is_internal=True,
            is_stator=False,
            L1=0.5,
            Nrvd=0,
            Wrvd=0.05,
        )
        magnet = [MagnetType10(Lmag=0.5, Hmag=0.02, Wmag=0.08)]
        rotor.slot = SlotMFlat(Zs=8,
                               H0=0,
                               W0=2 * pi / 10,
                               W0_is_rad=True,
                               magnet=magnet)
        rotor.mat_type.mag = MatMagnetics(Wlam=0.5e-3)

        rotor.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 10)
        fig.savefig(join(save_path, "test_Lam_Mag_10s_2-Rotor.png"))

        magnet2 = [MagnetType10(Lmag=0.5, Hmag=0.02, Wmag=0.04)]
        rotor.slot = SlotMFlat(Zs=8, W0=0.04, W0_is_rad=False, magnet=magnet2)
        rotor.plot()
        fig = plt.gcf()
        fig.savefig(join(save_path, "test_Lam_Mag_10s_5-Rotor 2.png"))
Пример #2
0
    def test_Lam_Mag_10_surface(self):
        """Test machine plot with Magnet 10 surface"""

        plt.close("all")
        test_obj = Machine()
        test_obj.rotor = LamSlotMag(
            Rint=40e-3,
            Rext=200e-3,
            is_internal=True,
            is_stator=False,
            L1=0.5,
            Nrvd=0,
            Wrvd=0.05,
        )
        magnet = [MagnetType10(Lmag=0.5, Hmag=0.02, Wmag=0.08)]
        test_obj.rotor.slot = SlotMFlat(Zs=8,
                                        H0=0,
                                        W0=2 * pi / 10,
                                        W0_is_rad=True,
                                        magnet=magnet)
        test_obj.rotor.mat_type.magnetics = MatLamination(Wlam=0.5e-3)
        test_obj.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=0.55)

        test_obj.stator = Lamination(
            Rint=230e-3,
            Rext=0.3,
            is_internal=False,
            is_stator=True,
            L1=0.5,
            Nrvd=0,
            Wrvd=0.05,
        )
        test_obj.stator.mat_type.magnetics = MatLamination(Wlam=0.5e-3)
        test_obj.frame = Frame(Rint=200e-3, Rext=250e-3, Lfra=0.5)

        test_obj.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 15)
        fig.savefig(join(save_path, "test_Lam_Mag_10s_1-Machine.png"))

        test_obj.rotor.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 10)
        fig.savefig(join(save_path, "test_Lam_Mag_10s_2-Rotor.png"))

        test_obj.stator.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 2)
        fig.savefig(join(save_path, "test_Lam_Mag_10s_3-Stator.png"))

        magnet2 = [MagnetType10(Lmag=0.5, Hmag=0.02, Wmag=0.04)]
        test_obj.rotor.slot = SlotMFlat(Zs=8,
                                        W0=0.04,
                                        W0_is_rad=False,
                                        magnet=magnet2)
        test_obj.plot()
        fig = plt.gcf()
        fig.savefig(join(save_path, "test_Lam_Mag_10s_5-Rotor 2.png"))
Пример #3
0
    def test_Lam_Mag_10_inset(self):
        """Test machine plot with Magnet 10 inset"""

        plt.close("all")
        rotor = LamSlotMag(
            Rint=40e-3,
            Rext=100e-3,
            is_internal=True,
            is_stator=False,
            L1=0.45,
            Nrvd=1,
            Wrvd=0.05,
        )
        magnet = [MagnetType10(Lmag=0.5, Hmag=0.02, Wmag=0.04)]
        rotor.slot = SlotMFlat(Zs=4, W0=0.04, H0=0.02, magnet=magnet)
        rotor.mat_type.mag = MatMagnetics(Wlam=0.5e-3)

        rotor.axial_vent.append(VentilationCirc(Zh=4, Alpha0=0, D0=2.5e-3, H0=50e-3))
        rotor.axial_vent.append(VentilationCirc(Zh=8, Alpha0=0, D0=5e-3, H0=60e-3))
        rotor.axial_vent.append(VentilationCirc(Zh=12, Alpha0=0, D0=10e-3, H0=70e-3))

        stator = LamSlotMag(
            Rint=110e-3,
            Rext=200e-3,
            is_internal=False,
            is_stator=True,
            L1=0.45,
            Nrvd=1,
            Wrvd=0.05,
        )

        magnet2 = [MagnetType10(Lmag=0.5, Hmag=0.02, Wmag=0.04)]
        stator.slot = SlotMFlat(Zs=8, W0=0.04, W3=2 * pi / 64, H0=0.02, magnet=magnet2)
        stator.mat_type.mag = MatMagnetics(Wlam=0.5e-3)

        stator.axial_vent.append(
            VentilationTrap(Zh=6, Alpha0=pi / 6, W1=10e-3, W2=20e-3, D0=0.02, H0=0.140)
        )
        stator.axial_vent.append(
            VentilationTrap(Zh=6, Alpha0=pi / 6, W1=20e-3, W2=40e-3, D0=0.02, H0=0.170)
        )

        rotor.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 30)
        fig.savefig(join(save_path, "test_Lam_Mag_10i_2-Rotor.png"))

        stator.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 22)
        fig.savefig(join(save_path, "test_Lam_Mag_10i_3-Stator.png"))
Пример #4
0
    def test_build_geometry_two_hole_with_magnet(self):
        """check that curve_list is correct (one hole)
        """
        test_obj = LamHole(is_internal=True, is_stator=False, Rext=0.075)
        test_obj.hole = list()
        test_obj.hole.append(
            HoleM50(
                Zh=8,
                W0=50e-3,
                W1=2e-3,
                W2=1e-3,
                W3=1e-3,
                W4=20.6e-3,
                H0=17.3e-3,
                H1=1.25e-3,
                H2=0.5e-3,
                H3=6.8e-3,
                H4=1e-3,
                magnet_0=MagnetType10(Wmag=0.01, Hmag=0.02),
            )
        )

        result = test_obj.hole[0].build_geometry()
        self.assertEqual(len(result), 6)
        for surf in result:
            self.assertTrue(type(surf) is SurfLine)

        self.assertEqual(result[0].label[:5], "Hole_")
        self.assertEqual(result[0].label[-9:], "_R0_T0_S0")
        self.assertEqual(len(result[0].line_list), 7)

        self.assertEqual(result[1].label[:11], "HoleMagnet_")
        self.assertEqual(result[1].label[-11:], "_N_R0_T0_S0")
        self.assertEqual(len(result[1].line_list), 6)

        self.assertEqual(result[2].label[:5], "Hole_")
        self.assertEqual(result[2].label[-9:], "_R0_T1_S0")
        self.assertEqual(len(result[2].line_list), 4)

        self.assertEqual(result[3].label[:5], "Hole_")
        self.assertEqual(result[3].label[-9:], "_R0_T2_S0")
        self.assertEqual(len(result[3].line_list), 4)

        self.assertEqual(result[4].label[:11], "HoleMagnet_")
        self.assertEqual(result[4].label[-11:], "_N_R0_T1_S0")
        self.assertEqual(len(result[4].line_list), 6)

        self.assertEqual(result[5].label[:5], "Hole_")
        self.assertEqual(result[5].label[-9:], "_R0_T3_S0")
        self.assertEqual(len(result[5].line_list), 7)
    def test_build_geometry_out(self):
        """check that curve_list is correct (outwards magnet)
        """

        lam = LamSlotMag(
            Rint=1,
            Rext=0.09,
            is_internal=False,
            is_stator=False,
            L1=0.45,
            Nrvd=1,
            Wrvd=0.05,
        )
        lam.slot = SlotMFlat(Zs=8,
                             W0=0.6,
                             H0=0.2,
                             magnet=[MagnetType10(Wmag=0.6, Hmag=0.2)])
        test_obj = lam.slot.magnet[0]
        alpha = lam.slot.comp_angle_opening_magnet()
        Z1 = 1 * exp(-1j * alpha / 2) + 0.2
        Z2 = 1 * exp(1j * alpha / 2) + 0.2
        Z3 = Z1 - 0.2
        Z4 = Z2 - 0.2

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

        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)
    def test_build_geometry_one_hole_with_magnet(self):
        """check that curve_list is correct (one hole)
        """
        test_obj = LamHole(is_internal=True, Rext=0.075)
        test_obj.hole = list()
        test_obj.hole.append(
            HoleM50(
                Zh=8,
                W0=52e-3,
                W1=0,
                W2=1e-3,
                W3=1e-3,
                W4=20.6e-3,
                H0=17.3e-3,
                H1=1.25e-3,
                H2=0.5e-3,
                H3=6.8e-3,
                H4=0,
                magnet_0=MagnetType10(Wmag=0.01, Hmag=0.02),
            ))

        result = test_obj.hole[0].build_geometry()
        self.assertEqual(len(result), 5)
        for surf in result:
            self.assertTrue(type(surf) is SurfLine)

        self.assertEqual(result[0].label, "Air")
        self.assertEquals(len(result[0].line_list), 5)

        self.assertEqual(result[1].label, "MagnetS_N_R0_T0_S0")
        self.assertEquals(len(result[1].line_list), 6)

        self.assertEqual(result[2].label, "Air")
        self.assertEquals(len(result[2].line_list), 6)

        self.assertEqual(result[3].label, "MagnetS_N_R0_T1_S0")
        self.assertEquals(len(result[3].line_list), 6)

        self.assertEqual(result[4].label, "Air")
        self.assertEquals(len(result[4].line_list), 5)
    def test_Lam_Mag_10_inset_2_mag(self):
        """Test machine plot with Magnet 10 inset with two magnet in the slot"""
        plt.close("all")
        test_obj = Machine()
        test_obj.rotor = LamSlotMag(
            Rint=40e-3,
            Rext=100e-3,
            is_internal=True,
            is_stator=False,
            L1=0.45,
            Nrvd=1,
            Wrvd=0.05,
        )
        test_obj.rotor.slot = SlotMFlat(
            Zs=4,
            W0=0.03,
            H0=0.02,
            W3=2 * pi / 60,
            magnet=[
                MagnetType10(Lmag=0.5, Hmag=0.015, Wmag=0.03),
                MagnetType10(Lmag=0.5, Hmag=0.015, Wmag=0.03),
            ],
        )
        test_obj.rotor.mat_type.mag = MatLamination(Wlam=0.5e-3)
        test_obj.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=0.55)
        test_obj.rotor.axial_vent.append(
            VentilationCirc(Zh=4, Alpha0=0, D0=2.5e-3, H0=50e-3))
        test_obj.rotor.axial_vent.append(
            VentilationCirc(Zh=8, Alpha0=0, D0=5e-3, H0=60e-3))
        test_obj.rotor.axial_vent.append(
            VentilationCirc(Zh=12, Alpha0=0, D0=10e-3, H0=70e-3))
        test_obj.stator = LamSlotMag(
            Rint=110e-3,
            Rext=200e-3,
            is_internal=False,
            is_stator=True,
            L1=0.45,
            Nrvd=1,
            Wrvd=0.05,
        )

        test_obj.stator.slot = SlotMFlat(
            Zs=8,
            W0=0.03,
            W3=2 * pi / 64,
            H0=0.02,
            magnet=[
                MagnetType10(Lmag=0.5, Hmag=0.025, Wmag=0.03),
                MagnetType10(Lmag=0.5, Hmag=0.025, Wmag=0.03),
            ],
        )
        test_obj.stator.mat_type.mag = MatLamination(Wlam=0.5e-3)
        test_obj.frame = Frame(Rint=200e-3, Rext=250e-3, Lfra=0.5)
        test_obj.stator.axial_vent.append(
            VentilationTrap(Zh=6,
                            Alpha0=pi / 6,
                            W1=10e-3,
                            W2=20e-3,
                            D0=0.02,
                            H0=0.140))
        test_obj.stator.axial_vent.append(
            VentilationTrap(Zh=6,
                            Alpha0=pi / 6,
                            W1=20e-3,
                            W2=40e-3,
                            D0=0.02,
                            H0=0.170))
        test_obj.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 67)
        fig.savefig(join(save_path, "test_Lam_Mag_10i_1_Mag_2-Machine.png"))

        test_obj.rotor.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 34)
        fig.savefig(join(save_path, "test_Lam_Mag_10i_2_Mag_2-Rotor.png"))

        test_obj.stator.plot()
        fig = plt.gcf()
        self.assertEqual(len(fig.axes[0].patches), 30)
        fig.savefig(join(save_path, "test_Lam_Mag_10i_3_Mag_2-Stator.png"))
from ddt import ddt, data

from pyleecan.Classes.LamSlotMag import LamSlotMag
from pyleecan.Classes.SlotMFlat import SlotMFlat
from pyleecan.Classes.MagnetType10 import MagnetType10
from pyleecan.Classes.Segment import Segment
from pyleecan.Methods.Machine.Magnet.comp_surface import comp_surface

from numpy import exp

Mag10_test = list()
# Internal Slot
lam = LamSlotMag(is_internal=True, Rext=0.1325)
lam.slot = SlotMFlat(H0=5e-3, W0=10e-3, Zs=12)
lam.slot.magnet = [MagnetType10(Hmag=5e-3, Wmag=10e-3)]
Mag10_test.append({
    "test_obj": lam,
    "S_exp": 5e-5,
    "Ao": 0.078449,
    "H_exp": 5e-3
})

# Outward Slot
lam = LamSlotMag(is_internal=False, Rint=0.1325)
lam.slot = SlotMFlat(H0=5e-3, W0=10e-3, Zs=12)
lam.slot.magnet = [MagnetType10(Hmag=5e-3, Wmag=10e-3)]
Mag10_test.append({
    "test_obj": lam,
    "S_exp": 5e-5,
    "Ao": 0.072745,