示例#1
0
    def test_set_slot_25(self):
        """Check that you can edit a Slot 25"""
        Zs = int(uniform(1, 100))
        self.test_obj.stator.slot = SlotW25(Zs=Zs)
        self.widget = SWSlot(self.test_obj, matlib=[], is_stator=True)

        self.assertEqual(self.widget.si_Zs.value(), Zs)
        self.assertEqual(self.widget.c_slot_type.currentText(), "Slot Type 25")
        self.assertEqual(self.widget.c_slot_type.currentIndex(), 11)
        self.assertEqual(type(self.widget.w_slot), PWSlot25)
示例#2
0
    def test_init(self):
        """Check that the Widget spinbox initialise to the lamination value"""

        self.assertEqual(self.widget.lf_H1.value(), 0.11)
        self.assertEqual(self.widget.lf_H2.value(), 0.12)
        self.assertEqual(self.widget.lf_W3.value(), 0.14)
        self.assertEqual(self.widget.lf_W4.value(), 0.15)

        self.test_obj.slot = SlotW25(H1=0.21, H2=0.22, W3=0.24, W4=0.25)
        self.widget = PWSlot25(self.test_obj)
        self.assertEqual(self.widget.lf_H1.value(), 0.21)
        self.assertEqual(self.widget.lf_H2.value(), 0.22)
        self.assertEqual(self.widget.lf_W3.value(), 0.24)
        self.assertEqual(self.widget.lf_W4.value(), 0.25)
示例#3
0
 def test_output_txt(self):
     """Check that the Output text is computed and correct
     """
     self.test_obj = LamSlotWind(
         Rint=0,
         Rext=0.5,
         is_internal=True,
         is_stator=False,
         L1=0.9,
         Nrvd=1,
         Wrvd=0.1,
     )
     self.test_obj.slot = SlotW25(Zs=12, W4=150e-3, W3=75e-3, H1=30e-3, H2=150e-3)
     self.widget = PWSlot25(self.test_obj)
     self.assertEqual(
         self.widget.w_out.out_slot_height.text(), "Slot height: 0.1789 m"
     )
示例#4
0
    def setUp(self):
        """Run at the begining of every test to setup the gui"""

        self.test_obj = LamSlotWind(Rint=0.1, Rext=0.2)
        self.test_obj.slot = SlotW25(H1=0.11, H2=0.12, W3=0.14, W4=0.15)
        self.widget = PWSlot25(self.test_obj)
示例#5
0
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)
slotW25_test.append(
示例#6
0
    def test_Lam_Wind_25_wind_22(self):
        """Test machine plot with Slot 25 and winding rad=2, tan=2
        """
        print("\nTest plot Slot 25")
        plt.close("all")
        test_obj = Machine()
        test_obj.rotor = LamSlotWind(
            Rint=0,
            Rext=0.5,
            is_internal=True,
            is_stator=False,
            L1=0.9,
            Nrvd=1,
            Wrvd=0.1,
        )
        test_obj.rotor.slot = SlotW25(Zs=6,
                                      W4=150e-3,
                                      W3=75e-3,
                                      H1=30e-3,
                                      H2=150e-3)
        test_obj.rotor.winding = WindingUD(user_wind_mat=wind_mat,
                                           qs=4,
                                           p=4,
                                           Lewout=100e-3)
        test_obj.rotor.mat_type.mag = MatLamination(Wlam=0.5e-3)
        test_obj.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=1)

        test_obj.stator = LamSlotWind(
            Rint=0.51,
            Rext=0.8,
            is_internal=False,
            is_stator=True,
            L1=0.9,
            Nrvd=1,
            Wrvd=0.1,
        )
        test_obj.stator.slot = SlotW25(Zs=18,
                                       W4=150e-3,
                                       W3=75e-3,
                                       H1=30e-3,
                                       H2=150e-3)
        test_obj.stator.winding = WindingDW2L(qs=3, p=3)
        test_obj.stator.mat_type.mag = MatLamination(Wlam=0.5e-3)
        test_obj.stator.winding.Lewout = 100e-3
        test_obj.frame = Frame(Rint=0.8, Rext=0.8, Lfra=1)

        test_obj.plot()
        fig = plt.gcf()
        fig.savefig(join(save_path, "test_Lam_Wind_s25_1-Machine.png"))
        # Rotor + Stator + 0 for frame + 0 for shaft
        self.assertEqual(len(fig.axes[0].patches), 63)

        test_obj.rotor.plot()
        fig = plt.gcf()
        fig.savefig(join(save_path, "test_Lam_Wind_s25_2-Rotor.png"))
        # 1 for lam + Zs*4 for wind
        self.assertEqual(len(fig.axes[0].patches), 25)

        test_obj.stator.plot()
        fig = plt.gcf()
        fig.savefig(join(save_path, "test_Lam_Wind_s25_3-Stator.png"))
        # 2 for lam + Zs*2 for wind
        self.assertEqual(len(fig.axes[0].patches), 38)