コード例 #1
0
    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
コード例 #2
0
 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])
コード例 #3
0
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,
コード例 #4
0
ファイル: CEFC_Lam.py プロジェクト: BoGuo86/pyleecan
    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,
コード例 #5
0
    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,
コード例 #6
0
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
コード例 #7
0
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,
コード例 #8
0
ファイル: SynRM_001.py プロジェクト: saras152/pyleecan
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
コード例 #9
0
ファイル: __init__.py プロジェクト: focus2010/pyleecan
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
コード例 #10
0
    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)
コード例 #11
0
class MachineSyRM(MachineSync):
    """Synchronous Reluctance Machine"""

    VERSION = 1

    # Check ImportError to remove unnecessary dependencies in unused method
    # cf Methods.Machine.MachineSyRM.check
    if isinstance(check, ImportError):
        check = property(fget=lambda x: raise_(
            ImportError("Can't use MachineSyRM method check: " + str(check))))
    else:
        check = check
    # cf Methods.Machine.MachineSyRM.get_machine_type
    if isinstance(get_machine_type, ImportError):
        get_machine_type = property(fget=lambda x: raise_(
            ImportError("Can't use MachineSyRM method get_machine_type: " +
                        str(get_machine_type))))
    else:
        get_machine_type = get_machine_type
    # save method is available in all object
    save = save

    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)
        # The class is frozen (in MachineSync init), for now it's impossible to
        # add new properties

    def __str__(self):
        """Convert this objet in a readeable string (for print)"""

        MachineSyRM_str = ""
        # Get the properties inherited from MachineSync
        MachineSyRM_str += super(MachineSyRM, self).__str__()
        if self.rotor is not None:
            tmp = self.rotor.__str__().replace(linesep,
                                               linesep + "\t").rstrip("\t")
            MachineSyRM_str += "rotor = " + tmp
        else:
            MachineSyRM_str += "rotor = None" + linesep + linesep
        if self.stator is not None:
            tmp = self.stator.__str__().replace(linesep,
                                                linesep + "\t").rstrip("\t")
            MachineSyRM_str += "stator = " + tmp
        else:
            MachineSyRM_str += "stator = None" + linesep + linesep
        return MachineSyRM_str

    def __eq__(self, other):
        """Compare two objects (skip parent)"""

        if type(other) != type(self):
            return False

        # Check the properties inherited from MachineSync
        if not super(MachineSyRM, self).__eq__(other):
            return False
        if other.rotor != self.rotor:
            return False
        if other.stator != self.stator:
            return False
        return True

    def as_dict(self):
        """Convert this objet in a json seriable dict (can be use in __init__)
        """

        # Get the properties inherited from MachineSync
        MachineSyRM_dict = super(MachineSyRM, self).as_dict()
        if self.rotor is None:
            MachineSyRM_dict["rotor"] = None
        else:
            MachineSyRM_dict["rotor"] = self.rotor.as_dict()
        if self.stator is None:
            MachineSyRM_dict["stator"] = None
        else:
            MachineSyRM_dict["stator"] = self.stator.as_dict()
        # The class name is added to the dict fordeserialisation purpose
        # Overwrite the mother class name
        MachineSyRM_dict["__class__"] = "MachineSyRM"
        return MachineSyRM_dict

    def _set_None(self):
        """Set all the properties to None (except pyleecan object)"""

        if self.rotor is not None:
            self.rotor._set_None()
        if self.stator is not None:
            self.stator._set_None()
        # Set to None the properties inherited from MachineSync
        super(MachineSyRM, self)._set_None()

    def _get_rotor(self):
        """getter of rotor"""
        return self._rotor

    def _set_rotor(self, value):
        """setter of rotor"""
        check_var("rotor", value, "LamHole")
        self._rotor = value

        if self._rotor is not None:
            self._rotor.parent = self

    # Machine's Rotor
    # Type : LamHole
    rotor = property(fget=_get_rotor,
                     fset=_set_rotor,
                     doc=u"""Machine's Rotor""")

    def _get_stator(self):
        """getter of stator"""
        return self._stator

    def _set_stator(self, value):
        """setter of stator"""
        check_var("stator", value, "LamSlotWind")
        self._stator = value

        if self._stator is not None:
            self._stator.parent = self

    # Machine's Stator
    # Type : LamSlotWind
    stator = property(fget=_get_stator,
                      fset=_set_stator,
                      doc=u"""Machine's Stator""")
コード例 #12
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.tab_hole.widget(0).w_hole.w_mat_0.c_mat_type.count(),
            4)
        self.assertEqual(
            self.widget.tab_hole.widget(
                0).w_hole.w_mat_0.c_mat_type.currentText(),
            "Magnet1",
        )
        self.assertEqual(
            self.widget.tab_hole.widget(
                0).w_hole.w_mat_0.c_mat_type.currentIndex(), 3)
        # Click to open matlib
        self.assertFalse(hasattr(self.widget, "mat_win"))
        self.widget.tab_hole.widget(0).w_hole.w_mat_0.b_matlib.clicked.emit()
        self.assertEqual(
            type(self.widget.tab_hole.widget(0).w_hole.w_mat_0.mat_win),
            DMatLib)
        # Check Matlib init
        self.assertEqual(
            self.widget.tab_hole.widget(
                0).w_hole.w_mat_0.mat_win.nav_mat.count(), 4)
        self.assertEqual(
            self.widget.tab_hole.widget(
                0).w_hole.w_mat_0.mat_win.nav_mat.currentItem().text(),
            "004 - Magnet1",
        )
        # Duplicate Magnet1
        self.assertFalse(
            hasattr(
                self.widget.tab_hole.widget(0).w_hole.w_mat_0.mat_win,
                "mat_win"))
        self.widget.tab_hole.widget(
            0).w_hole.w_mat_0.mat_win.b_duplicate.clicked.emit()
        self.assertEqual(
            type(
                self.widget.tab_hole.widget(0).w_hole.w_mat_0.mat_win.mat_win),
            DMatSetup,
        )
        # Edit Magnet1 to Magnet_test
        self.widget.tab_hole.widget(
            0).w_hole.w_mat_0.mat_win.mat_win.le_name.setText(
                "Magnet_test_python")
        self.widget.tab_hole.widget(
            0).w_hole.w_mat_0.mat_win.mat_win.le_name.editingFinished.emit()
        self.assertEqual(
            self.widget.tab_hole.widget(
                0).w_hole.w_mat_0.mat_win.mat_win.mat.name,
            "Magnet_test_python",
        )

        self.widget.tab_hole.widget(
            0).w_hole.w_mat_0.mat_win.mat_win.lf_rho_elec.setText("1234.56789")
        self.widget.tab_hole.widget(
            0).w_hole.w_mat_0.mat_win.mat_win.lf_rho_elec.editingFinished.emit(
            )
        self.assertEqual(
            self.widget.tab_hole.widget(
                0).w_hole.w_mat_0.mat_win.mat_win.mat.elec.rho,
            1234.56789,
        )
コード例 #13
0
ファイル: test_SMachineType.py プロジェクト: BoGuo86/pyleecan
    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)
コード例 #14
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,