def test_Lam_Wind_15_wind_22(self): """Test machine plot with Slot 15 and winding rad=2, tan=2 """ print("\nTest plot Slot 15 rad=2, tan=2") plt.close("all") test_obj = LamSlotWind( Rint=92.5e-3, Rext=0.2, is_internal=False, is_stator=True, L1=0.95, Nrvd=1, Wrvd=0.05, ) test_obj.slot = SlotW15(Zs=6, W0=10e-3, W3=30e-3, H0=5e-3, H1=20e-3, H2=50e-3, R1=15e-3, R2=10e-3) test_obj.winding = WindingUD(user_wind_mat=wind_mat, qs=4, p=4, Lewout=60e-3) test_obj.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s15.png")) # 2 for lam + Zs*4 for wind self.assertEqual(len(fig.axes[0].patches), 26)
def test_set_slot_15(self): """Check that you can edit a Slot 15""" Zs = int(uniform(1, 100)) self.test_obj.stator.slot = SlotW15(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 15") self.assertEqual(self.widget.c_slot_type.currentIndex(), 5) self.assertEqual(type(self.widget.w_slot), PWSlot15)
def setUp(self): """Run at the begining of every test to setup the gui""" self.test_obj = LamSlotWind(Rint=92.5e-3, Rext=0.2, is_internal=False) self.test_obj.slot = SlotW15(H0=0.10, H1=0.11, H2=0.12, W0=0.13, W3=0.14, R1=0.15, R2=0.16) self.widget = PWSlot15(self.test_obj)
def test_output_txt(self): """Check that the Output text is computed and correct """ self.test_obj.slot = SlotW15(Zs=6, W0=10e-3, W3=30e-3, H0=5e-3, H1=20e-3, H2=50e-3, R1=15e-3, R2=10e-3) self.widget = PWSlot15(self.test_obj) self.assertEqual(self.widget.w_out.out_slot_height.text(), "Slot height: 0.075 m")
def test_Lam_Wind_15_wind_22(self): """Test machine plot with Slot 15 and winding rad=2, tan=2 """ print("\nTest plot Slot 15") plt.close("all") test_obj = LamSlotWind( Rint=92.5e-3, Rext=0.2, is_internal=False, is_stator=True, L1=0.95, Nrvd=1, Wrvd=0.05, ) test_obj.slot = SlotW15(Zs=6, W0=10e-3, W3=30e-3, H0=5e-3, H1=20e-3, H2=50e-3, R1=15e-3, R2=10e-3) test_obj.winding = WindingUD(user_wind_mat=wind_mat, qs=4, p=4, Lewout=60e-3) test_obj.mat_type.name = "Param" test_obj.mat_type.magnetics = MatLamination(Wlam=0.5e-3) BH = BHCurveParam(Bmax=1.5, mur_0=8585, mur_1=21.79, a=0.25575) test_obj.mat_type.magnetics.BH_curve = BH test_obj.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s15.png")) # 2 for lam + Zs*4 for wind self.assertEqual(len(fig.axes[0].patches), 26)
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, }) @ddt class test_SlotW15_meth(TestCase): """unittest for SlotW15 methods"""