コード例 #1
0
    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")
コード例 #2
0
ファイル: test_Hole_54_plot.py プロジェクト: BoGuo86/pyleecan
    def test_Lam_Hole_54_plot(self):
        """Test machine plot hole 54"""

        plt.close("all")
        test_obj = MachineIPMSM()
        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)
コード例 #3
0
ファイル: test_SMachineType.py プロジェクト: BoGuo86/pyleecan
    def test_set_p_ipmsm(self):
        """Check that the Widget allow to update p"""
        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.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)
コード例 #4
0
ファイル: test_SMHoleMag.py プロジェクト: focus2010/pyleecan
    def setUp(self):
        """Run at the begining of every test to setup the gui"""

        self.test_obj = MachineIPMSM(type_machine=8)
        self.test_obj.stator = LamSlotWind()
        self.test_obj.stator.winding.p = 4
        self.test_obj.rotor = LamHole(Rint=0.1, Rext=0.2)
        self.test_obj.rotor.hole = list()
        self.test_obj.rotor.hole.append(HoleM50(Zh=8))
        self.test_obj.rotor.hole[0].magnet_0.mat_type.name = "Magnet3"

        self.test_obj2 = MachineSyRM(type_machine=5)
        self.test_obj2.stator = LamSlotWind()
        self.test_obj2.stator.winding.p = 4
        self.test_obj2.rotor = LamHole(Rint=0.1, Rext=0.2)
        self.test_obj2.rotor.hole = list()
        self.test_obj2.rotor.hole.append(HoleM54(Zh=16))

        self.matlib = list()
        self.matlib.append(Material(name="Magnet1"))
        self.matlib.append(Material(name="Magnet2"))
        self.matlib.append(Material(name="Magnet3"))

        self.widget = SMHoleMag(machine=self.test_obj,
                                matlib=self.matlib,
                                is_stator=False)
        self.widget2 = SMHoleMag(machine=self.test_obj2,
                                 matlib=self.matlib,
                                 is_stator=False)
コード例 #5
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)
コード例 #6
0
ファイル: test_Hole_51_plot.py プロジェクト: BoGuo86/pyleecan
    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(
            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 = 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
コード例 #7
0
ファイル: test_Hole_53_plot.py プロジェクト: BoGuo86/pyleecan
    def setUp(self):
        """Run at the begining of every test to setup the machine"""
        plt.close("all")
        test_obj = MachineIPMSM()
        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
コード例 #8
0
ファイル: test_Hole_50_plot.py プロジェクト: BoGuo86/pyleecan
    def setUp(self):
        """Run at the begining of every test to setup the machine"""
        plt.close("all")
        test_obj = MachineIPMSM()
        test_obj.rotor = LamHole(is_internal=True,
                                 Rint=0.021,
                                 Rext=0.075,
                                 is_stator=False,
                                 L1=0.7)
        test_obj.rotor.bore = BoreFlower(N=8, Rarc=0.05, alpha=pi / 8)
        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=3e-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.shaft = Shaft(Drsh=test_obj.rotor.Rint * 2, Lshaft=1.2)

        test_obj.stator = LamSlotWind(Rint=0.078,
                                      Rext=0.104,
                                      is_internal=False,
                                      is_stator=True,
                                      L1=0.8)
        test_obj.stator.slot = None
        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.frame = Frame(Rint=0.104, Rext=0.114, Lfra=1)

        self.test_obj = test_obj
コード例 #9
0
ファイル: test_Hole_52_plot.py プロジェクト: BoGuo86/pyleecan
    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
コード例 #10
0
    Alpha0=0, 
    D0=5e-3, 
    H0=40e-3
))
rotor.axial_vent.append(VentilationCirc(
    Zh=8, 
    Alpha0=pi / 8, 
    D0=7e-3, 
    H0=40e-3
))
"""
shaft = Shaft(Drsh=rotor.Rint * 2, Lshaft=1.2)

frame = Frame(Rint=stator.Rext, Rext=stator.Rext + 10 * mm, Lfra=1)

# Set Materials
stator.mat_type = M400_50A
rotor.mat_type = M400_50A
stator.winding.conductor.cond_mat = Copper1
rotor.hole[0].magnet_0.mat_type = Magnet3
rotor.hole[0].magnet_1.mat_type = Magnet3

rotor.hole[0].magnet_0.type_magnetization = 1
rotor.hole[0].magnet_1.type_magnetization = 1

IPMSM_xxx = MachineIPMSM(name="IPMSM",
                         stator=stator,
                         rotor=rotor,
                         shaft=shaft,
                         frame=frame)
コード例 #11
0
    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 = 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_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 = 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_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)
コード例 #12
0
class test_Workflow_DMatLib(TestCase):
    """Test that the widget DMatLib behave like it should when called from a Widget
    """
    def setUp(self):
        """Run at the begining of every test to create the workspace
        """
        self.work_path = join(save_path, "Material Workflow")
        # Delete old test if needed
        if isdir(self.work_path):
            rmtree(self.work_path)
        mkdir(self.work_path)
        copyfile(
            join(DATA_DIR, "Material", "Magnet1.json"),
            join(self.work_path, "Magnet1.json"),
        )
        copyfile(
            join(DATA_DIR, "Material", "Copper1.json"),
            join(self.work_path, "Copper1.json"),
        )
        copyfile(
            join(DATA_DIR, "Material", "Insulator1.json"),
            join(self.work_path, "Insulator1.json"),
        )
        copyfile(
            join(DATA_DIR, "Material", "M400-50A.json"),
            join(self.work_path, "M400-50A.json"),
        )
        self.matlib = load_matlib(self.work_path)

    def teardown(self):
        """Delete the workspace at the end of the tests
        """
        if is_clean_result:
            rmtree(self.work_path)

    @classmethod
    def setUpClass(cls):
        """Start the app for the test"""
        print("\nStart Test Workflow MatLib")
        cls.app = QtWidgets.QApplication(sys.argv)

    @classmethod
    def tearDownClass(cls):
        """Exit the app after the test"""
        cls.app.quit()

    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_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)
コード例 #13
0
        H2=0.001,
        H3=0.0065,
        H4=0,
        W0=0.042,
        W1=0,
        W2=0,
        W3=0.014,
        W4=0.0189,
    )
]
rotor.hole[0].magnet_0.type_magnetization = 1
rotor.hole[0].magnet_1.type_magnetization = 1
shaft = Shaft(Lshaft=0.1, Drsh=0.11064)
frame = None

# Set Materials
stator.mat_type = M400_50A
rotor.mat_type = M400_50A
stator.winding.conductor.cond_mat = Copper1
rotor.hole[0].magnet_0.mat_type = Magnet_prius
rotor.hole[0].magnet_1.mat_type = Magnet_prius

IPMSM_A = MachineIPMSM(
    name="IPMSM_A",
    desc="TOYOTA Prius 2004 interior magnet (V shape) with distributed winding",
    stator=stator,
    rotor=rotor,
    shaft=shaft,
    frame=frame,
)
コード例 #14
0
ファイル: test_comp_mass.py プロジェクト: BoGuo86/pyleecan
from numpy import array, pi, zeros

from pyleecan.Classes.MachineIPMSM import MachineIPMSM
from pyleecan.Classes.LamSlotWind import LamSlotWind
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 = MachineIPMSM()
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,
コード例 #15
0
ファイル: __init__.py プロジェクト: focus2010/pyleecan
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
machine6.type_machine = 6
machine6.stator.is_stator = True
machine6.rotor.is_stator = False

machine7 = MachineSIPMSM(init_dict=machine6.as_dict())
machine7.type_machine = 7

machine8 = MachineIPMSM()
machine8.stator = LamSlotWind()
machine8.stator.winding = WindingDW2L()
machine8.rotor = LamHole()
machine8.rotor.hole = list()
machine8.rotor.hole.append(HoleM50())
machine8._set_None()  # Empty machine
machine8.type_machine = 8
machine8.stator.is_stator = True
machine8.rotor.is_stator = False

machine9 = MachineWRSM()
machine9.stator = LamSlotWind()
machine9.stator.winding = WindingDW2L()
machine9.rotor = LamSlotWind()
machine9.rotor.winding = WindingCW2LT()
コード例 #16
0
ファイル: CEFC_Lam.py プロジェクト: BoGuo86/pyleecan
        H2=0.001,
        H3=0.0065,
        H4=0,
        W0=0.042,
        W1=0,
        W2=0,
        W3=0.014,
        W4=0.0189,
    )
]
rotor.hole[0].magnet_0.type_magnetization = 1
rotor.hole[0].magnet_1.type_magnetization = 1
shaft = Shaft(Lshaft=0.1, Drsh=0.11064)
frame = None

# Set Materials
stator.mat_type = M400_50A
rotor.mat_type = M400_50A
# stator.winding.conductor.cond_mat = Copper1
rotor.hole[0].magnet_0.mat_type = Magnet_prius
rotor.hole[0].magnet_1.mat_type = Magnet_prius

CEFC_Lam = MachineIPMSM(
    name="CEFC_Lam",
    desc="Slotless machine from CEFC publication",
    stator=stator,
    rotor=rotor,
    shaft=shaft,
    frame=frame,
)
コード例 #17
0
I_1 = ImportMatrixVal(value=zeros((100, 2)))
I_2 = ImportMatrixVal(value=zeros((100, 3)))
I_3 = ImportMatrixVal(value=zeros((2, 100)))
I_4 = ImportMatrixVal(value=zeros((100)))

angle_rotor_wrong = ImportMatrixVal(value=zeros((10, 2)))
angle_rotor_wrong2 = ImportMatrixVal(value=zeros((102)))
angle_rotor = ImportMatrixVal(value=zeros((100)))

Nr_wrong = ImportMatrixVal(value=zeros((10, 2)))
Nr_wrong2 = ImportMatrixVal(value=zeros((102)))
Nr = ImportMatrixVal(value=zeros((100)))

# Winding stator only
M1 = MachineIPMSM()
M1.stator = LamSlotWind()
M1.stator.winding = WindingDW1L()
M1.stator.winding.qs = 3

# Machine without 'comp_initial_angle' method
M2 = MachineDFIM()
M2.stator = LamSlotWind()
M2.stator.winding.qs = 3
M2.rotor.winding = None

# Wrong time
test_obj = Simulation()
test_obj.input = InCurrentDQ(time=None)
InCurrentDQ_Error_test.append({
    "test_obj": test_obj,