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 = SlotW61( H0=0.10, H1=0.11, H2=0.12, W0=0.13, W1=0.14, W2=0.15, H3=0.16, H4=0.17, W3=0.18, ) self.widget = PWSlot61(self.test_obj)
def test_Lam_Wind_61(self): """Test machine plot with Slot 61 """ print("\nTest plot Slot 61") plt.close("all") test_obj = Machine() test_obj.rotor = LamSlotWind(Rint=0, Rext=0.1325, is_internal=True, is_stator=False, L1=0.9) test_obj.rotor.slot = SlotW61( Zs=12, W0=15e-3, W1=35e-3, W2=12.5e-3, H0=15e-3, H1=20e-3, H2=25e-3, H3=1e-3, H4=2e-3, W3=3e-3, ) test_obj.rotor.winding = WindingCW2LT(qs=3, p=3, Lewout=60e-3) plt.close("all") test_obj.rotor.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s61_1-Rotor.png")) # 1 for Lam, Zs*2 for wind self.assertEqual(len(fig.axes[0].patches), 25) test_obj.rotor.slot.W3 = 0 test_obj.rotor.slot.H3 = 0 test_obj.rotor.slot.H4 = 0 test_obj.rotor.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s61_2-Rotor Wind.png")) # 1 for Lam, Zs*2 for wind self.assertEqual(len(fig.axes[0].patches), 25) tooth = test_obj.rotor.slot.get_surface_tooth() tooth.plot(color="r") fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s61_Tooth_in.png"))
def test_init_61(self): """Check that the Widget initialize to the correct slot""" self.test_obj.rotor.slot = SlotW61( Zs=0, H0=0.10, H1=0.11, H2=0.12, W0=0.125, W1=0.14, W2=0.15, H3=0.16, H4=0.17, W3=0.18, ) self.test_obj.rotor.winding.p = 8 self.widget = SWPole(self.test_obj, matlib=[], is_stator=False) self.assertEqual(self.widget.in_Zs.text(), "Zs = 2*p = 16") self.assertEqual(self.widget.c_slot_type.currentIndex(), 1) self.assertEqual(type(self.widget.w_slot), PWSlot61)
def test_out(self): """Checking output """ self.test_obj = LamSlotWind(Rint=0, Rext=0.1325, is_internal=True, is_stator=False, L1=0.9) self.test_obj.slot = SlotW61( Zs=12, W0=15e-3, W1=35e-3, W2=12.5e-3, H0=15e-3, H1=20e-3, H2=25e-3, H3=1e-3, H4=2e-3, W3=3e-3, ) self.widget = PWSlot61(self.test_obj) self.assertEqual(self.widget.out_slot_height.text(), "Slot height: 0.05994 m") self.assertTrue(self.widget.out_tooth_width.isHidden())
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 SlotW61_test = list() # Internal Slot lam = LamSlot(is_internal=True, Rext=0.1325) lam.slot = SlotW61( Zs=12, W0=15e-3, W1=40e-3, W2=12.5e-3, H0=15e-3, H1=20e-3, H2=25e-3, H3=0, H4=0, W3=0, ) SlotW61_test.append({ "test_obj": lam, "S_exp": 1.69308e-3, "Aw": 0.29889, "SW_exp": 6.875e-4, "H_exp": 5.9942749e-2, "Ao": 0.41033, }) # Internal Slot small wind