def setUp(self): """Run at the begining of every test to setup the machine""" plt.close("all") test_obj = Machine() test_obj.rotor = LamHole( Rint=45e-3 / 2, Rext=81.5e-3, is_stator=False, is_internal=True, L1=0.9 ) test_obj.rotor.hole = list() test_obj.rotor.hole.append( HoleM51( Zh=8, W0=0.016, W1=pi / 6, W2=0.004, W3=0.01, W4=0.002, W5=0.01, W6=0.002, W7=0.01, H0=0.01096, H1=0.0015, H2=0.0055, ) ) test_obj.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=1.2) test_obj.stator = Lamination( Rint=0.09, Rext=0.12, is_internal=False, is_stator=True, L1=0.9 ) test_obj.frame = Frame(Rint=0.12, Rext=0.12, Lfra=0.7) self.test_obj = test_obj
def setUp(self): """Run at the begining of every test to setup the gui""" self.test_obj = LamHole(Rint=0.1, Rext=0.2) self.test_obj.hole = list() self.test_obj.hole.append( HoleM50( H0=0.10, H1=0.11, H2=0.12, W0=0.13, W1=0.14, W2=0.15, H3=0.16, W3=0.17, H4=0.18, W4=0.19, ) ) self.test_obj.hole[0].magnet_0.mat_type.name = "Magnet3" self.test_obj.hole[0].magnet_1.mat_type.name = "Magnet2" self.matlib = list() self.matlib.append(Material(name="Magnet1")) self.matlib.append(Material(name="Magnet2")) self.matlib.append(Material(name="Magnet3")) self.widget = PHoleM50(self.test_obj.hole[0], self.matlib)
def setUp(self): """Run at the begining of every test to setup the gui""" self.test_obj = LamHole(Rint=0.1, Rext=0.2) self.test_obj.hole = list() self.test_obj.hole.append( HoleM52(H0=0.10, H1=0.11, H2=0.12, W0=0.13, W3=0.17)) self.widget = PHoleM52(self.test_obj.hole[0])
def test_Lam_Hole_54_plot(self): """Test machine plot hole 54""" plt.close("all") test_obj = Machine() test_obj.rotor = LamHole(is_internal=True, Rint=0.1, Rext=0.2, is_stator=False, L1=0.7) test_obj.rotor.hole = list() test_obj.rotor.hole.append( HoleM54(Zh=8, W0=pi / 4, H0=50e-3, H1=10e-3, R1=100e-3)) test_obj.rotor.hole.append( HoleM54(Zh=8, W0=pi / 6, H0=25e-3, H1=10e-3, R1=100e-3)) test_obj.rotor.plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Hole_s54-Rotor.png")) self.assertEqual(len(fig.axes[0].patches), 18) test_obj.rotor.hole[0].plot() fig = plt.gcf() fig.savefig(join(save_path, "test_Lam_Hole_s54-Rotor hole.png")) self.assertEqual(len(fig.axes[0].patches), 1)
def test_set_p_syrm(self): """Check that the Widget allow to update p""" self.test_obj = MachineSyRM(name="test_machine_ipmsm", type_machine=5) self.test_obj.stator = LamSlotWind(is_stator=True, is_internal=True, Rint=0.21, Rext=0.22) self.test_obj.rotor = LamHole(is_stator=False, is_internal=False, Rint=0.11, Rext=0.12) self.test_obj.rotor.hole = list() self.test_obj.rotor.hole.append(HoleM50(Zh=0)) self.widget = SMachineType(machine=self.test_obj, matlib=[], is_stator=False) # Clear the field before writing the new value self.widget.si_p.clear() value = int(uniform(3, 100)) QTest.keyClicks(self.widget.si_p, str(value)) self.widget.si_p.editingFinished.emit() # To trigger the slot self.assertEqual(self.test_obj.stator.winding.p, value) self.assertEqual(self.test_obj.rotor.hole[0].Zh, 2 * value)
def test_build_geometry_one_hole_no_mag(self): """check that curve_list is correct (one hole no mag) """ 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=None, magnet_1=None, )) result = test_obj.hole[0].build_geometry() self.assertEqual(len(result), 1) for surf in result: self.assertTrue(type(surf) is SurfLine) self.assertEqual(result[0].label, "Air") self.assertEquals(len(result[0].line_list), 16)
def test_init_empty(self): """Check that the widget can open with an unknown material """ self.machine = MachineIPMSM() self.machine.stator = LamSlotWind() self.machine.rotor = LamHole() self.machine._set_None() self.machine.stator.winding.p = 4 self.machine.type_machine = 8 self.machine.rotor.hole = [HoleM50()] self.machine.rotor.hole[ 0].magnet_0.mat_type.name = "Magnet_doesnot_exist" self.widget = SMHoleMag(machine=self.machine, matlib=self.matlib, is_stator=False) # Check default material self.assertEqual(self.widget.w_mat.c_mat_type.count(), 4) self.assertEqual(self.widget.w_mat.c_mat_type.currentText(), "") self.assertEqual(self.widget.w_mat.c_mat_type.currentIndex(), -1) # Click to open matlib self.assertFalse(hasattr(self.widget, "mat_win")) self.widget.w_mat.b_matlib.clicked.emit() self.assertEqual(type(self.widget.w_mat.mat_win), DMatLib) # Check Matlib init self.assertEqual(self.widget.w_mat.mat_win.nav_mat.count(), 4) self.assertEqual( self.widget.w_mat.mat_win.nav_mat.currentItem().text(), "001 - Copper1")
def test_build_geometry_no_magnet(self, test_dict): """Check that the surf list is correct without magnet """ test_obj = LamHole(init_dict=test_dict["test_obj"].as_dict()) test_obj.hole[0].magnet_0 = None result = test_obj.hole[0].build_geometry() self.assertEquals(len(result), 1) for surf in result: self.assertTrue(type(surf) == SurfLine) self.assertEqual(result[0].label, "Air") self.assertEquals(len(result[0].line_list), 8)
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(self, test_dict): """Check that the surf list is correct """ test_obj = LamHole(init_dict=test_dict["test_obj"].as_dict()) result = test_obj.hole[0].build_geometry() self.assertEquals(len(result), 1) for surf in result: self.assertTrue(type(surf) == SurfLine) self.assertEqual(result[0].label, "Air") self.assertEquals(len(result[0].line_list), 4) self.assertEqual(type(result[0].line_list[0]), Arc1) self.assertEqual(type(result[0].line_list[1]), Arc3) self.assertEqual(type(result[0].line_list[2]), Arc1) self.assertEqual(type(result[0].line_list[3]), Arc3)
def setUp(self): """Run at the begining of every test to setup the machine""" plt.close("all") test_obj = Machine() test_obj.rotor = LamHole(is_internal=True, Rint=0.021, Rext=0.075, is_stator=False, L1=0.7) test_obj.rotor.hole = list() test_obj.rotor.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=0, )) test_obj.rotor.axial_vent = list() test_obj.rotor.axial_vent.append( VentilationCirc(Zh=8, Alpha0=0, D0=5e-3, H0=40e-3)) test_obj.rotor.axial_vent.append( VentilationCirc(Zh=8, Alpha0=pi / 8, D0=7e-3, H0=40e-3)) test_obj.rotor.mat_type.magnetics = MatLamination(Wlam=0.5e-3) test_obj.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=1.2) test_obj.stator = Lamination(Rint=0.078, Rext=0.104, is_internal=False, is_stator=True, L1=0.8) test_obj.stator.axial_vent.append( VentilationPolar(Zh=8, H0=0.08, D0=0.01, W1=pi / 8, Alpha0=pi / 8)) test_obj.stator.axial_vent.append( VentilationPolar(Zh=8, H0=0.092, D0=0.01, W1=pi / 8, Alpha0=0)) test_obj.stator.mat_type.magnetics = MatLamination(Wlam=0.5e-3) test_obj.frame = Frame(Rint=0.104, Rext=0.114, Lfra=1) self.test_obj = test_obj
def setUp(self): """Run at the begining of every test to setup the machine""" plt.close("all") test_obj = MachineIPMSM() test_obj.rotor = LamHole( Rint=45e-3 / 2, Rext=81.5e-3, is_stator=False, is_internal=True, L1=0.9 ) test_obj.rotor.hole = list() test_obj.rotor.hole.append( HoleM52(Zh=8, W0=27e-3, W3=16.2e-3, H0=1e-3, H1=5e-3, H2=1e-3) ) test_obj.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=1.2) test_obj.stator = LamSlotWind( Rint=0.09, Rext=0.12, is_internal=False, is_stator=True, L1=0.9, slot=None ) test_obj.frame = Frame(Rint=0.12, Rext=0.12, Lfra=0.7) self.test_obj = test_obj
def setUp(self): """Run at the begining of every test to setup the gui""" self.test_obj = LamHole(Rint=0.1, Rext=0.2) self.test_obj.hole = list() self.test_obj.hole.append( HoleM51( H0=0.10, H1=0.11, H2=0.12, W0=0.13, W1=0.14, W2=0.15, W3=0.16, W4=0.17, W5=0.18, W6=0.19, W7=0.2, )) self.widget = PHoleM51(self.test_obj.hole[0])
def test_init(self): """Check that the Widget spinbox initialise to the lamination value """ self.machine = MachineIPMSM() self.machine.stator = LamSlotWind() self.machine.rotor = LamHole() self.machine._set_None() self.machine.stator.winding.p = 4 self.machine.type_machine = 8 self.widget = SMHoleMag(machine=self.machine, matlib=self.matlib, is_stator=False) # Check default (hole is set to type 50) self.assertEqual(self.widget.w_mat.c_mat_type.count(), 4) self.assertEqual(self.widget.w_mat.c_mat_type.currentText(), "Magnet1") self.assertEqual(self.widget.w_mat.c_mat_type.currentIndex(), 3) # Click to open matlib self.assertFalse(hasattr(self.widget, "mat_win")) self.widget.w_mat.b_matlib.clicked.emit() self.assertEqual(type(self.widget.w_mat.mat_win), DMatLib) # Check Matlib init self.assertEqual(self.widget.w_mat.mat_win.nav_mat.count(), 4) self.assertEqual( self.widget.w_mat.mat_win.nav_mat.currentItem().text(), "004 - Magnet1") # Duplicate Magnet1 self.assertFalse(hasattr(self.widget.w_mat.mat_win, "mat_win")) self.widget.w_mat.mat_win.b_duplicate.clicked.emit() self.assertEqual(type(self.widget.w_mat.mat_win.mat_win), DMatSetup) # Edit Magnet1 to Magnet_test self.widget.w_mat.mat_win.mat_win.le_name.setText("Magnet_test_python") self.widget.w_mat.mat_win.mat_win.le_name.editingFinished.emit() self.assertEqual(self.widget.w_mat.mat_win.mat_win.mat.name, "Magnet_test_python") self.widget.w_mat.mat_win.mat_win.lf_rho_elec.setText("1234.56789") self.widget.w_mat.mat_win.mat_win.lf_rho_elec.editingFinished.emit() self.assertEqual(self.widget.w_mat.mat_win.mat_win.mat.elec.rho, 1234.56789)
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_comp_surface(self): """Check that the computation of the slot surface is correct """ test_obj = LamHole(is_internal=True, 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, )) result = test_obj.hole[0].comp_surface() a = result b = 3.77977e-04 self.assertAlmostEqual((a - b) / a, 0, delta=DELTA)
def setUp(self): """Run at the begining of every test to setup the machine""" plt.close("all") test_obj = Machine() test_obj.rotor = LamHole( is_internal=True, Rint=0.1, Rext=0.2, is_stator=False, L1=0.7 ) test_obj.rotor.hole = list() test_obj.rotor.hole.append( HoleM53( Zh=8, W1=15e-3, W2=10e-3, W3=40e-3, W4=pi / 4, H0=75e-3, H1=5e-3, H2=20e-3, H3=5e-3, ) ) self.test_obj = test_obj
def test_build_geometry_two_hole_no_mag(self): """check that curve_list is correct (two holes no magnet) """ test_obj = LamHole(is_internal=True, 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=None, magnet_1=None, ) ) result = test_obj.hole[0].build_geometry() self.assertEqual(len(result), 2) for surf in result: self.assertTrue(type(surf) is SurfLine) self.assertEqual(result[0].label[:4], "Hole") self.assertEqual(result[0].label[-9:], "_R0_T0_S0") self.assertEqual(len(result[0].line_list), 11) self.assertEqual(result[1].label[:4], "Hole") self.assertEqual(result[1].label[-9:], "_R0_T1_S0") self.assertEqual(len(result[1].line_list), 11)
machine1.rotor.is_stator = False machine4 = MachineDFIM() machine4.stator = LamSlotWind() machine4.stator.winding = WindingDW2L() machine4.rotor = LamSlotWind() machine4.rotor.winding = WindingDW2L() machine4._set_None() # Empty machine machine4.type_machine = 4 machine4.stator.is_stator = True machine4.rotor.is_stator = False machine5 = MachineSyRM() machine5.stator = LamSlotWind() machine5.stator.winding = WindingDW2L() machine5.rotor = LamHole() machine5.rotor.hole = list() machine5.rotor.hole.append(HoleM50()) machine5.rotor.hole[0].remove_magnet() machine5._set_None() # Empty machine machine5.type_machine = 5 machine5.stator.is_stator = True machine5.rotor.is_stator = False machine6 = MachineSIPMSM() machine6.stator = LamSlotWind() machine6.stator.winding = WindingDW2L() machine6.rotor = LamSlotMag() machine6.rotor.slot = SlotMPolar() machine6.rotor.slot.magnet = [MagnetType11()] machine6._set_None() # Empty machine
def test_init(self): """Check that the Widget spinbox initialise to the lamination value""" self.assertEqual(self.widget.le_name.text(), "test_machine") self.assertEqual(self.widget.si_p.value(), 6) self.assertEqual(self.widget.c_type.currentIndex(), 0) self.assertEqual(self.widget.c_type.currentText(), "SCIM") self.assertEqual(self.widget.is_inner_rotor.checkState(), Qt.Checked) # DFIM self.test_obj = MachineDFIM(name="test_machine_dfim", type_machine=4) self.test_obj.stator = LamSlotWind(is_stator=True, is_internal=True, Rint=0.21, Rext=0.22) self.test_obj.stator.winding.p = 7 self.test_obj.rotor = LamSlotWind(is_stator=False, is_internal=False, Rint=0.11, Rext=0.12) self.widget = SMachineType(machine=self.test_obj, matlib=[], is_stator=False) self.assertEqual(self.widget.le_name.text(), "test_machine_dfim") self.assertEqual(self.widget.si_p.value(), 7) self.assertEqual(self.widget.c_type.currentIndex(), 1) self.assertEqual(self.widget.c_type.currentText(), "DFIM") self.assertEqual(self.widget.is_inner_rotor.checkState(), Qt.Unchecked) # SyRM self.test_obj = MachineSyRM(name="test_machine_syrm", type_machine=5) self.test_obj.stator = LamSlotWind(is_stator=True, is_internal=True, Rint=0.21, Rext=0.22) self.test_obj.stator.winding.p = 21 self.test_obj.rotor = LamHole(is_stator=False, is_internal=False, Rint=0.11, Rext=0.12) self.widget = SMachineType(machine=self.test_obj, matlib=[], is_stator=False) self.assertEqual(self.widget.le_name.text(), "test_machine_syrm") self.assertEqual(self.widget.si_p.value(), 21) self.assertEqual(self.widget.c_type.currentIndex(), 2) self.assertEqual(self.widget.c_type.currentText(), "SyRM") self.assertEqual(self.widget.is_inner_rotor.checkState(), Qt.Unchecked) # SPMSM self.test_obj = MachineSIPMSM(name="test_machine_spmsm", type_machine=6) self.test_obj.stator = LamSlotWind(is_stator=True, is_internal=True, Rint=0.21, Rext=0.22) self.test_obj.stator.winding.p = 8 self.test_obj.rotor = LamSlotMag(is_stator=False, is_internal=False, Rint=0.11, Rext=0.12) self.widget = SMachineType(machine=self.test_obj, matlib=[], is_stator=False) self.assertEqual(self.widget.le_name.text(), "test_machine_spmsm") self.assertEqual(self.widget.si_p.value(), 8) self.assertEqual(self.widget.c_type.currentIndex(), 3) self.assertEqual(self.widget.c_type.currentText(), "SPMSM") self.assertEqual(self.widget.is_inner_rotor.checkState(), Qt.Unchecked) # SIPMSM self.test_obj = MachineSIPMSM(name="test_machine_sipmsm", type_machine=7) self.test_obj.stator = LamSlotWind(is_stator=True, is_internal=False, Rint=0.21, Rext=0.22) self.test_obj.stator.winding.p = 9 self.test_obj.rotor = LamSlotMag(is_stator=False, is_internal=True, Rint=0.11, Rext=0.12) self.widget = SMachineType(machine=self.test_obj, matlib=[], is_stator=False) self.assertEqual(self.widget.le_name.text(), "test_machine_sipmsm") self.assertEqual(self.widget.si_p.value(), 9) self.assertEqual(self.widget.c_type.currentIndex(), 4) self.assertEqual(self.widget.c_type.currentText(), "SIPMSM") self.assertEqual(self.widget.is_inner_rotor.checkState(), Qt.Checked) # IPMSM self.test_obj = MachineIPMSM(name="test_machine_ipmsm", type_machine=8) self.test_obj.stator = LamSlotWind(is_stator=True, is_internal=True, Rint=0.21, Rext=0.22) self.test_obj.stator.winding.p = 10 self.test_obj.rotor = LamHole(is_stator=False, is_internal=False, Rint=0.11, Rext=0.12) self.widget = SMachineType(machine=self.test_obj, matlib=[], is_stator=False) self.assertEqual(self.widget.le_name.text(), "test_machine_ipmsm") self.assertEqual(self.widget.si_p.value(), 10) self.assertEqual(self.widget.c_type.currentIndex(), 5) self.assertEqual(self.widget.c_type.currentText(), "IPMSM") self.assertEqual(self.widget.is_inner_rotor.checkState(), Qt.Unchecked) # WRSM self.test_obj = MachineWRSM(name="test_machine_wrsm", type_machine=9) self.test_obj.stator = LamSlotWind(is_stator=True, is_internal=True, Rint=0.21, Rext=0.22) self.test_obj.stator.winding.p = 5 self.test_obj.rotor = LamSlotWind(is_stator=False, is_internal=False, Rint=0.11, Rext=0.12) self.widget = SMachineType(machine=self.test_obj, matlib=[], is_stator=False) self.assertEqual(self.widget.le_name.text(), "test_machine_wrsm") self.assertEqual(self.widget.si_p.value(), 5) self.assertEqual(self.widget.c_type.currentIndex(), 6) self.assertEqual(self.widget.c_type.currentText(), "WRSM") self.assertEqual(self.widget.is_inner_rotor.checkState(), Qt.Unchecked)
def __init__( self, rotor=-1, stator=-1, frame=-1, shaft=-1, name="default_machine", desc="", type_machine=1, init_dict=None, ): """Constructor of the class. Can be use in two ways : - __init__ (arg1 = 1, arg3 = 5) every parameters have name and default values for Matrix, None will initialise the property with an empty Matrix for pyleecan type, None will call the default constructor - __init__ (init_dict = d) d must be a dictionnary wiht every properties as keys ndarray or list can be given for Vector and Matrix object or dict can be given for pyleecan Object""" if rotor == -1: rotor = LamHole() if stator == -1: stator = LamSlotWind() if frame == -1: frame = Frame() if shaft == -1: shaft = Shaft() if init_dict is not None: # Initialisation by dict check_init_dict( init_dict, [ "rotor", "stator", "frame", "shaft", "name", "desc", "type_machine" ], ) # Overwrite default value with init_dict content if "rotor" in list(init_dict.keys()): rotor = init_dict["rotor"] if "stator" in list(init_dict.keys()): stator = init_dict["stator"] if "frame" in list(init_dict.keys()): frame = init_dict["frame"] if "shaft" in list(init_dict.keys()): shaft = init_dict["shaft"] if "name" in list(init_dict.keys()): name = init_dict["name"] if "desc" in list(init_dict.keys()): desc = init_dict["desc"] if "type_machine" in list(init_dict.keys()): type_machine = init_dict["type_machine"] # Initialisation by argument # rotor can be None, a LamHole object or a dict if isinstance(rotor, dict): self.rotor = LamHole(init_dict=rotor) else: self.rotor = rotor # stator can be None, a LamSlotWind object or a dict if isinstance(stator, dict): # Check that the type is correct (including daughter) class_name = stator.get("__class__") if class_name not in ["LamSlotWind", "LamSquirrelCage"]: raise InitUnKnowClassError("Unknow class name " + class_name + " in init_dict for stator") # Dynamic import to call the correct constructor module = __import__("pyleecan.Classes." + class_name, fromlist=[class_name]) class_obj = getattr(module, class_name) self.stator = class_obj(init_dict=stator) else: self.stator = stator # Call MachineSync init super(MachineSyRM, self).__init__(frame=frame, shaft=shaft, name=name, desc=desc, type_machine=type_machine)
Ntcoil=2, # number of turns per coil Npcpp=1, # number of parallel circuits per phase Nslot_shift_wind=0, # ) stator.winding.conductor = CondType12( Wwire=1.0 * mm, # single wire without isolation Wins_wire=0.1 * mm, # single wire isolation thickness Wins_cond=1.3 * mm, # winding coil isolation Nwppc=1, # number of strands in parallel per coil Kwoh=1, ) # Rotor setup rotor = LamHole(Rint=59 * mm / 2, Rext=158 * mm / 2, is_internal=True, is_stator=False, L1=stator.L1) rotor.hole = list() rotor.hole.append( HoleM50( Zh=8, W0=43.4 * mm, W1=3.0 * mm, W2=1.0 * mm, W3=10.0 * mm, W4=22.0 * mm, H0=20.0 * mm, H1=2.0 * mm, H2=2.5 * mm, H3=6.0 * mm,
stator.winding = WindingDW1L(qs=3, Lewout=15e-3, p=2, Ntcoil=30, Npcpp=1, coil_pitch=6) stator.winding.conductor = CondType12(Nwppc=1, Wwire=0.001, Kwoh=0.5, Wins_wire=1e-6) # Rotor setup rotor = LamHole(Rext=0.0406, Rint=0, L1=0.101, Kf1=0.96, is_internal=True, is_stator=False, Nrvd=0) rotor.hole = list() rotor.hole.append(HoleM54(Zh=4, H0=0.004, H1=0.0041, W0=0.78, R1=0.025)) rotor.hole.append(HoleM54(Zh=4, H0=0.011, H1=0.0041, W0=1.22, R1=0.03)) rotor.hole.append(HoleM54(Zh=4, H0=0.0185, H1=0.0041, W0=1.44, R1=0.035)) shaft = None frame = None # Set Materials stator.mat_type = M530_65A rotor.mat_type = M530_65A stator.winding.conductor.cond_mat = Copper1
from unittest import TestCase from ddt import ddt, data from pyleecan.Classes.Segment import Segment from pyleecan.Classes.SurfLine import SurfLine from pyleecan.Classes.LamHole import LamHole from pyleecan.Classes.HoleM52 import HoleM52 from numpy import exp, arcsin, ndarray, pi # For AlmostEqual DELTA = 1e-6 HoleM52_test = list() test_obj = LamHole(is_internal=True, is_stator=False, hole=list(), Rext=0.1) test_obj.hole = list() test_obj.hole.append( HoleM52(Zh=8, W0=30e-3, W3=15e-3, H0=12e-3, H1=18e-3, H2=2e-3)) HoleM52_test.append({ "test_obj": test_obj, "S_exp": 8.059458e-4, "SM_exp": 5.4e-4, "Rmin": 6.587571e-2, "Rmax": 8.8e-2, "W1": 4.9971e-3, "alpha": 0.614736, }) @ddt
from pyleecan.Classes.LamHole import LamHole from pyleecan.Classes.VentilationCirc import VentilationCirc from pyleecan.Classes.VentilationPolar import VentilationPolar from pyleecan.Classes.HoleM50 import HoleM50 from pyleecan.Classes.Frame import Frame from pyleecan.Classes.Shaft import Shaft # For AlmostEqual DELTA = 1e-4 M_test = list() test_obj = Machine() test_obj.rotor = LamHole(is_internal=True, Rint=0.021, Rext=0.075, is_stator=False, L1=0.7, Nrvd=0, Kf1=0.95) test_obj.rotor.hole = list() test_obj.rotor.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,
Rext=134.62e-3, Nrvd=0, L1=0.08382, Kf1=0.95, is_internal=False, is_stator=True, ) stator.slot = None stator.winding = None # Rotor setup rotor = LamHole( Rext=80.2e-3, Rint=55.32e-3, L1=0.08382, Kf1=0.95, is_internal=True, is_stator=False, Nrvd=0, ) rotor.hole = [ HoleM50( Zh=8, H0=0.01096, H1=0.0015, H2=0.001, H3=0.0065, H4=0, W0=0.042, W1=0, W2=0,
from ddt import ddt, data from pyleecan.Classes.Segment import Segment from pyleecan.Classes.SurfLine import SurfLine from pyleecan.Classes.LamHole import LamHole from pyleecan.Classes.HoleM53 import HoleM53 from numpy import exp, arcsin, ndarray, pi # For AlmostEqual DELTA = 1e-6 HoleM53_test = list() # Two hole test_obj = LamHole(is_internal=True, Rext=80.2e-3, Rint=0) test_obj.hole = list() test_obj.hole.append( HoleM53(Zh=8, H0=0.02, H1=0.001, H2=0.01, H3=0.003, W1=0.005, W2=0, W3=0.01, W4=0.78)) HoleM53_test.append({ "test_obj": test_obj, "S_exp": 3.63836e-4, "SM_exp": 0.0002,
from pyleecan.Classes.Segment import Segment from pyleecan.Classes.SurfLine import SurfLine from pyleecan.Classes.LamHole import LamHole from pyleecan.Classes.HoleM51 import HoleM51 from numpy import exp, arcsin, ndarray, pi # For AlmostEqual DELTA = 1e-4 HoleM51_test = list() test_obj = LamHole(Rint=45e-3 / 2, Rext=81.5e-3, is_stator=False, is_internal=True, L1=0.9) test_obj.hole = list() test_obj.hole.append( HoleM51( Zh=8, W0=0.016, W1=pi / 6, W2=0.004, W3=0.01, W4=0.002, W5=0.01, W6=0.002, W7=0.01, H0=0.01096,
def setUp(self): """Run at the begining of every test to setup the gui""" self.test_obj = LamHole(Rint=0.1, Rext=0.2) self.test_obj.hole = list() self.test_obj.hole.append(HoleM54(H0=0.10, H1=0.11, W0=0.12, R1=0.13)) self.widget = PHoleM54(self.test_obj.hole[0], matlib=[])