def test_Lam_Wind_24_wind_22(self): """Test machine plot with Slot 24 and winding rad=2, tan=2 """ print("\nTest plot Slot 24") plt.close("all") test_obj = Machine() test_obj.rotor = LamSlotWind( Rint=0.2, Rext=0.5, is_internal=True, is_stator=False, L1=0.8, Nrvd=4, Wrvd=0.05, ) test_obj.rotor.slot = SlotW24(Zs=6, W3=100e-3, H2=150e-3) test_obj.rotor.winding = WindingUD(user_wind_mat=wind_mat, qs=4, p=4, Lewout=120e-3) test_obj.rotor.mat_type.magnetics = 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.8, Nrvd=4, Wrvd=0.05, ) test_obj.stator.slot = SlotW24(Zs=18, W3=50e-3, H2=200e-3) test_obj.stator.winding = WindingDW2L(qs=3, p=3) test_obj.stator.mat_type.magnetics = MatLamination(Wlam=0.5e-3) test_obj.stator.winding.Lewout = 120e-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_s24_1-Machine.png")) # Rotor + Stator + 0 for frame + 1 for shaft self.assertEqual(len(fig.axes[0].patches), 65) test_obj.rotor.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s24_2-Rotor.png")) # 2 for lam + 4*Zs for wind self.assertEqual(len(fig.axes[0].patches), 26) test_obj.stator.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Wind_s24_3-Stator.png")) # 2 for lam + 2*Zs for wind self.assertEqual(len(fig.axes[0].patches), 38)
def test_set_slot_24(self): """Check that you can edit a Slot 24""" Zs = int(uniform(1, 100)) self.test_obj.stator.slot = SlotW24(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 24") self.assertEqual(self.widget.c_slot_type.currentIndex(), 10) self.assertEqual(type(self.widget.w_slot), PWSlot24)
def test_init(self): """Check that the Widget spinbox initialise to the lamination value""" self.assertEqual(self.widget.lf_H2.value(), 0.12) self.assertEqual(self.widget.lf_W3.value(), 0.15) self.test_obj.slot = SlotW24(H2=0.22, W3=0.25) self.widget = PWSlot24(self.test_obj) self.assertEqual(self.widget.lf_H2.value(), 0.22) self.assertEqual(self.widget.lf_W3.value(), 0.25)
def test_output_txt(self): """Check that the Output text is computed and correct """ self.test_obj = LamSlotWind( Rint=0.2, Rext=0.5, is_internal=True, is_stator=False, L1=0.8, Nrvd=4, Wrvd=0.05, ) self.test_obj.slot = SlotW24(Zs=12, W3=100e-3, H2=150e-3) self.widget = PWSlot24(self.test_obj) self.assertEqual( self.widget.w_out.out_slot_height.text(), "Slot height: 0.15 m" )
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) slotW24_test.append(
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 = SlotW24(H2=0.12, W3=0.15) self.widget = PWSlot24(self.test_obj)